Skip to content

feat: update get jobs handler to allow query for running jobs only#1299

Open
ndrpp wants to merge 2 commits intomainfrom
feat/1283-running-jobs
Open

feat: update get jobs handler to allow query for running jobs only#1299
ndrpp wants to merge 2 commits intomainfrom
feat/1283-running-jobs

Conversation

@ndrpp
Copy link
Copy Markdown
Member

@ndrpp ndrpp commented Mar 26, 2026

Fixes # .

Changes proposed in this PR:

  • add runningJobs: boolean to getJobs handler to include only running jobs
  • if fromTimestamp is also present, return running Jobs created since

@ndrpp ndrpp marked this pull request as ready for review March 26, 2026 15:04
@alexcos20
Copy link
Copy Markdown
Member

/run-security-scan

Copy link
Copy Markdown
Member

@alexcos20 alexcos20 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants