Skip to content

Commit

Permalink
chore: Log receipt CIDs on workflow completed
Browse files Browse the repository at this point in the history
  • Loading branch information
bgins committed Mar 11, 2024
1 parent 60c4d41 commit b7ad003
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions homestar-runtime/src/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ pub trait Database: Send + Sync + Clone {
let workflow = Self::select_workflow(workflow_cid, conn)?;
let associated_receipts = workflow::StoredReceipt::belonging_to(&workflow)
.select(schema::workflows_receipts::receipt_cid)
.order(schema::workflows_receipts::receipt_cid.desc())
.load(conn)?;

let cids = associated_receipts
Expand Down
7 changes: 7 additions & 0 deletions homestar-runtime/src/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -474,10 +474,17 @@ where
let conn = &mut self.db.conn()?;
Db::set_workflow_status(self.workflow_info.cid, workflow::Status::Completed, conn)?;

// Retrieve receipt CIDs from database
let mut receipt_cids = match Db::get_workflow_info(self.workflow_info.cid, conn) {
Ok(info) => info.1.progress.iter().map(|cid| cid.to_string()).collect(),
Err(_) => vec!["<none>".to_string()],
};

info!(
subject = "worker.end_workflow",
category = "worker.run",
workflow_cid = self.workflow_info.cid.to_string(),
receipt_cids = receipt_cids.join(","),
"workflow completed"
);

Expand Down

0 comments on commit b7ad003

Please sign in to comment.