From f7cab9737483dc5030dd1a9f61e9d09093b9911c Mon Sep 17 00:00:00 2001 From: CeciliaZ030 <45245961+CeciliaZ030@users.noreply.github.com> Date: Tue, 16 Jul 2024 08:37:18 -0400 Subject: [PATCH] feat(tasks): add README & return the latest status only from POST 'proof/report' (#319) * bd latest status * Update README.md --- README.md | 14 ++++++++++++++ tasks/src/mem_db.rs | 3 ++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index dae080dcd..95085b2fa 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,20 @@ Look into `prove-block.sh` for the available options or run the script without i ./script/prove-block.sh taiko_a7 native sync ``` +### Task Management +The script `prove-block.sh` always sends a POST request to Raiko server and enqueue a proving task. If you repeately send the same request, it will pull the latest status of the task and return the proof if ready. +To check the progress of all tasks: + +```shell + curl --location --request POST 'http://localhost:8080/proof/report' +``` + +To prune all tasks (the cancellation feature that kills prover is still WIP): + +```shell + curl --location --request POST 'http://localhost:8080/proof/prune' +``` + ## Provers For all host programs, you can enable CPU optimization through exporting `CPU_OPT=1`. diff --git a/tasks/src/mem_db.rs b/tasks/src/mem_db.rs index 146b54cb3..f0496d3b1 100644 --- a/tasks/src/mem_db.rs +++ b/tasks/src/mem_db.rs @@ -136,8 +136,9 @@ impl InMemoryTaskDb { .enqueue_task .iter() .flat_map(|(descriptor, statuses)| { + // Return the latest status statuses - .iter() + .last() .map(|status| TaskReport(descriptor.clone(), status.0)) }) .collect())