Skip to content

Commit

Permalink
log taskids and failed prompts
Browse files Browse the repository at this point in the history
  • Loading branch information
erhant committed Jan 12, 2025
1 parent 5e513c3 commit 188bfd4
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 27 deletions.
4 changes: 2 additions & 2 deletions core/src/cli/commands/coordinator/serve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ impl DriaOracle {
Ok(None) => {
log::info!("Task {} ignored.", task_id)
}
Err(e) => log::error!("Could not process task: {:?}", e),
Err(e) => log::error!("Could not process task {}: {:?}", task_id, e),
}

Ok(())
Expand All @@ -41,7 +41,7 @@ impl DriaOracle {
};

if let Err(err) = handle_request(self, status, event.taskId, event.protocol).await {
log::error!("Could not process task: {:?}", err);
log::error!("Could not process task {}: {:?}", event.taskId, err);
}
}

Expand Down
7 changes: 6 additions & 1 deletion core/src/compute/generation/postprocess/swan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@ impl PostProcess for SwanPurchasePostProcessor {
.map(|end| input[start..start + end].to_string())
})
.ok_or_else(|| {
eyre::eyre!("could not find {} ~ {}", self.start_marker, self.end_marker)
eyre::eyre!(
"could not find {} ~ {} in result: {}",
input,
self.start_marker,
self.end_marker
)
})?;

// collect the chosen addresses
Expand Down
52 changes: 28 additions & 24 deletions misc/arweave.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,34 @@
* Can be piped to `pbcopy` on macOS to copy the output to clipboard.
*/

// parse input
let input = process.argv[2];
if (!input) {
console.error("No input provided.");
return;
}
async function main() {
// parse input
let input = process.argv[2];
if (!input) {
console.error("No input provided.");
return;
}

let arweaveTxId;
if (input.startsWith("0x")) {
// if it starts with 0x, we assume its all hex
arweaveTxId = JSON.parse(
Buffer.from(input.slice(2), "hex").toString()
).arweave;
} else if (input.startsWith("{")) {
// if it starts with {, we assume its a JSON string
console.log("input", input);
arweaveTxId = JSON.parse(input).arweave;
} else {
// otherwise, we assume its a base64 txid
arweaveTxId = input;
}

let arweaveTxId;
if (input.startsWith("0x")) {
// if it starts with 0x, we assume its all hex
arweaveTxId = JSON.parse(
Buffer.from(input.slice(2), "hex").toString()
).arweave;
} else if (input.startsWith("{")) {
// if it starts with {, we assume its a JSON string
console.log("input", input);
arweaveTxId = JSON.parse(input).arweave;
} else {
// otherwise, we assume its a base64 txid
arweaveTxId = input;
// construct the URL
// download the actual response from Arweave
const url = `https://arweave.net/${arweaveTxId}`;
const res = await fetch(url);
console.log(await res.text());
}

// construct the URL
// download the actual response from Arweave
const url = `https://arweave.net/${arweaveTxId}`;
const res = await fetch(url);
console.log(await res.text());
main().catch(console.error);

0 comments on commit 188bfd4

Please sign in to comment.