Skip to content

Commit

Permalink
feat(prover): store time taken by wvg
Browse files Browse the repository at this point in the history
  • Loading branch information
antoniolocascio committed Jul 10, 2024
1 parent db97fea commit 8d2e87a
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 2 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ALTER TABLE prover_jobs_fri
DROP COLUMN IF EXISTS wvg_time_taken;

ALTER TABLE prover_jobs_fri_archive
DROP COLUMN IF EXISTS wvg_time_taken;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ALTER TABLE prover_jobs_fri
ADD COLUMN IF NOT EXISTS wvg_time_taken TIME;

ALTER TABLE prover_jobs_fri_archive
ADD COLUMN IF NOT EXISTS wvg_time_taken TIME;
18 changes: 18 additions & 0 deletions prover/prover_dal/src/fri_prover_dal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,24 @@ impl FriProverDal<'_, '_> {
.unwrap()
}

pub async fn save_wvg_time_taken(&mut self, id: u32, wvg_time_taken: Duration) {
sqlx::query!(
r#"
UPDATE prover_jobs_fri
SET
updated_at = NOW(),
wvg_time_taken = $1
WHERE
id = $2
"#,
duration_to_naive_time_ms(wvg_time_taken),
i64::from(id)
)
.execute(self.storage.conn())
.await
.unwrap();
}

pub async fn requeue_stuck_jobs(
&mut self,
processing_timeout: Duration,
Expand Down
11 changes: 10 additions & 1 deletion prover/witness_vector_generator/src/generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,24 @@ impl JobProcessor for WitnessVectorGenerator {

METRICS.gpu_witness_vector_generation_time[&circuit_type].observe(started_at.elapsed());

let wvg_time_taken = started_at.elapsed();
tracing::info!(
"Finished witness vector generation for job: {job_id} in zone: {:?} took: {:?}",
self.zone,
started_at.elapsed()
wvg_time_taken
);

let serialized: Vec<u8> =
bincode::serialize(&artifacts).expect("Failed to serialize witness vector artifacts");

self.pool
.connection()
.await
.unwrap()
.fri_prover_jobs_dal()
.save_wvg_time_taken(job_id, wvg_time_taken)
.await;

let now = Instant::now();
let mut attempts = 0;

Expand Down

0 comments on commit 8d2e87a

Please sign in to comment.