feat: update get jobs handler to allow query for running jobs only#1299
feat: update get jobs handler to allow query for running jobs only#1299
Conversation
|
/run-security-scan |
alexcos20
left a comment
There was a problem hiding this comment.
AI automated code review (Gemini 3).
Overall risk: low
Summary:
This pull request introduces a new optional parameter runningJobs to the GetJobsCommand and its underlying database query logic. When runningJobs is set to true, the system specifically filters for compute jobs with a RunningAlgorithm status. Additionally, the fromTimestamp filter's behavior is modified in this context: it will filter by dateCreated instead of dateFinished, which is appropriate for querying currently active jobs. The changes are propagated correctly through the command handler and database layers, with the core logic implemented in sqliteCompute.ts to handle the conditional filtering.
Comments:
• [INFO][other] When task.runningJobs is provided, undefined is explicitly passed for the status parameter. While this works correctly because sqliteCompute.ts handles the status logic based on runningJobs, it might be slightly more explicit or defensive to pass C2DStatusNumber.RunningAlgorithm here if task.runningJobs is true, or only pass the original task.status if task.runningJobs is not present. This is a minor point, the current implementation is functional.
• [INFO][other] This conditional logic correctly adjusts the filtering behavior based on runningJobs. It's good that fromTimestamp switches to dateCreated for running jobs, and status is implicitly set to RunningAlgorithm. Consider adding a comment explaining this specific behavior change (from dateFinished to dateCreated for fromTimestamp) for future maintainability and clarity, especially since it modifies the meaning of fromTimestamp in this specific context.
Fixes # .
Changes proposed in this PR:
runningJobs: booleanto getJobs handler to include only running jobsfromTimestampis also present, return running Jobs created since