Skip to content

Commit

Permalink
Ensuring JobStatus structs have all fields filled out even if stored …
Browse files Browse the repository at this point in the history
…as part of quant item. Also ensuring start time is set, there were some ways in past where it ended up 0
  • Loading branch information
Peter Nemere committed Jun 14, 2024
1 parent 1e71fe8 commit ef41e36
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 12 deletions.
17 changes: 11 additions & 6 deletions api/quantification/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -378,12 +378,17 @@ func (r *quantNodeRunner) triggerPiquantNodes(wg *sync.WaitGroup) {
Params: r.quantStartSettings,
Elements: elements,
Status: &protos.JobStatus{
JobId: r.jobId,
Status: protos.JobStatus_COMPLETE,
Message: completeMsg,
EndUnixTimeSec: uint32(now),
OutputFilePath: quantOutPath,
OtherLogFiles: piquantLogList,
JobId: r.jobId,
JobItemId: r.jobId,
Status: protos.JobStatus_COMPLETE,
Message: completeMsg,
StartUnixTimeSec: r.quantStartSettings.StartUnixTimeSec,
EndUnixTimeSec: uint32(now),
OutputFilePath: quantOutPath,
OtherLogFiles: piquantLogList,
Name: r.quantStartSettings.UserParams.Name,
Elements: r.quantStartSettings.UserParams.Elements,
RequestorUserId: r.quantStartSettings.RequestorUserId,
},
}

Expand Down
16 changes: 10 additions & 6 deletions api/quantification/importCSV.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,16 @@ func ImportQuantCSV(
},
Elements: elements,
Status: &protos.JobStatus{
JobId: quantId,
Status: protos.JobStatus_COMPLETE,
Message: csvOrigin + " quantification processed",
OtherLogFiles: []string{},
EndUnixTimeSec: uint32(ownerItem.CreatedUnixSec),
OutputFilePath: quantOutPath,
JobId: quantId,
JobItemId: quantId,
Status: protos.JobStatus_COMPLETE,
Message: csvOrigin + " quantification processed",
OtherLogFiles: []string{},
EndUnixTimeSec: uint32(ownerItem.CreatedUnixSec),
OutputFilePath: quantOutPath,
StartUnixTimeSec: uint32(ownerItem.CreatedUnixSec),
Name: quantName,
Elements: elements,
},
}

Expand Down
6 changes: 6 additions & 0 deletions api/ws/handlers/quantification-retrieval.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ func HandleQuantGetReq(req *protos.QuantGetReq, hctx wsHelpers.HandlerContext) (
}
}

// We seem to have some old quants where the status struct says start time was 0, but there is another start time in quant params, so
// substitute a non-zero value in this case
if dbItem.Status.StartUnixTimeSec == 0 && dbItem.Params.StartUnixTimeSec > 0 {
dbItem.Status.StartUnixTimeSec = dbItem.Params.StartUnixTimeSec
}

dbItem.Owner = wsHelpers.MakeOwnerSummary(ownerItem, hctx.SessUser, hctx.Svcs.MongoDB, hctx.Svcs.TimeStamper)

return &protos.QuantGetResp{
Expand Down

0 comments on commit ef41e36

Please sign in to comment.