Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use query builder #25

Merged
merged 11 commits into from
Jan 5, 2024
Merged

Use query builder #25

merged 11 commits into from
Jan 5, 2024

Conversation

mahendrapaipuri
Copy link
Owner

  • Use a simple query builder to build queries
  • Include time zone in SLURM job start, end times
  • Add fields to BatchJob to set job start and end times in millisecond epochs. Grafana expects to and from in millisecond epochs
  • Emit number of rows deleted in DB ops
  • Set proper HTTP status codes
  • Misc fixes and improvs

Signed-off-by: Mahendra Paipuri <[email protected]>
* Simplified the logic of fetching jobs from DB

* Admin user can fetch all jobs of any user by setting special X-Dashboard-User header

* Use ISO date format used by Grafana

* Update and add new tests

Signed-off-by: Mahendra Paipuri <[email protected]>
* We need to have time zone information to be able to convert times between unix and dateformats easily

* Set SLURM_TIME_FORMAT env var for sacct command to include timezone in output

* Include time stamps in BatchJob struct as we need them to generate Grafana URLs

* Add env arg to os execute helpers to be able to set env vars to subprocesses

* Update functions using Execute calls to include env vars arg

Signed-off-by: Mahendra Paipuri <[email protected]>
* Grafana passes ISO time always in UTC zone

* If we want to use local browser time, we need to use timestamp as query parameter

* We simplify /api/jobs end point to accept timestamp as query parameter

* Update tests and fixtures accordingly

Signed-off-by: Mahendra Paipuri <[email protected]>
* Quoting SLURM_TIME_FORMAT is messing up DB entry format

Signed-off-by: Mahendra Paipuri <[email protected]>
* Emit log in debug mode on how many rows deleted

Signed-off-by: Mahendra Paipuri <[email protected]>
Signed-off-by: Mahendra Paipuri <[email protected]>
* Grafana expects a millisecond epoch for to and from query params

Signed-off-by: Mahendra Paipuri <[email protected]>
Signed-off-by: Mahendra Paipuri <[email protected]>
* We are always returning 200 for all responses

* Set correct response codes based on actual response

* Update tests

Signed-off-by: Mahendra Paipuri <[email protected]>
@mahendrapaipuri mahendrapaipuri merged commit f477ba9 into main Jan 5, 2024
5 checks passed
@mahendrapaipuri mahendrapaipuri deleted the use_query_builder branch January 5, 2024 08:32
@mahendrapaipuri mahendrapaipuri added enhancement New feature or request maintenance General maintenance labels Jan 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request maintenance General maintenance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant