Skip to content

Commit

Permalink
update: added error to job metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
heemankv committed Jul 23, 2024
1 parent c13a576 commit e611040
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions crates/orchestrator/src/jobs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,13 @@ pub async fn verify_job(id: Uuid) -> Result<()> {
JobVerificationStatus::Verified => {
config.database().update_job_status(&job, JobStatus::Completed).await?;
}
JobVerificationStatus::Rejected(_) => {
// TODO: change '_' to 'e' and add error 'e' to metadata of job status.
JobVerificationStatus::Rejected(e) => {
config.database().update_job_status(&job, JobStatus::VerificationFailed).await?;
let mut metadata = job.metadata.clone();
metadata.insert("error".to_string(), e);
config.database().update_metadata(&job, metadata).await?;

log::error!("Invalid status {:?} for job with id {:?}. Cannot verify.", id, job.status);

// retry job processing if we haven't exceeded the max limit
let process_attempts = get_u64_from_metadata(&job.metadata, JOB_PROCESS_ATTEMPT_METADATA_KEY)?;
Expand Down

0 comments on commit e611040

Please sign in to comment.