Skip to content

Add endpoints for fetching job and dataset rows of a task - #876

Merged
tmaeno merged 5 commits into
PanDAWMS:masterfrom
tmaeno:master
Nov 19, 2026
Merged

tmaeno merged 5 commits into
PanDAWMS:masterfrom
tmaeno:master

Conversation

@tmaeno

@tmaeno tmaeno commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

This pull request introduces two new paginated API endpoints to retrieve job and dataset rows for a given task, along with the necessary backend and test support. It also standardizes SQL query pagination syntax for compatibility across Oracle and PostgreSQL. The changes improve data access flexibility for clients and ensure consistent query behavior across supported databases.

New API Endpoints:

  • Added get_job_rows endpoint to task_api.py for retrieving job rows of a task, supporting pagination and windowing by modification time, with robust error handling and detailed response structure.
  • Added get_dataset_rows endpoint to task_api.py for retrieving dataset rows of a task, with pagination support and full column output.

Backend and Data Handling Enhancements:

  • Implemented corresponding backend methods in TaskBuffer.py and task_standalone_module.py to support the new endpoints, including logic for partitioning, windowing, and row selection. [1] [2]
  • Introduced constants and helper functions for job row columns, clock slack, and day window calculations to ensure correct and efficient data retrieval. [1] [2]

SQL Query Standardization:

  • Standardized SQL pagination by replacing backend-specific LIMIT clauses with the ANSI-compliant FETCH FIRST ... ROWS ONLY syntax, ensuring compatibility with both Oracle and PostgreSQL. Updated related unit tests accordingly. [1] [2] [3]

Testing:

  • Added comprehensive tests for the new endpoints in task_api_tests.py, including normal operation, pagination, invalid input, and edge cases.

These changes collectively improve the API's usability, consistency, and maintainability.

tmaeno and others added 5 commits November 18, 2026 21:16
The live-case harness reads the jobs and the datasets of a task through
db_read, which waits behind the greps of the async daemon: a fetch holding
one took 10.8 s at the median against 0.3 s without. No sync endpoint gives
these rows: get_job_ids has PandaIDs only, get_job_descriptions peeks every
job, and get_datasets_and_files and get_details give a few dataset columns.

- GET /v1/task/get_job_rows returns 11 columns of the jobs of a task from
  jobsDefined4, jobsActive4, jobsArchived4 and the archive, read by one UNION
  statement as getPandaIDsWithTaskID reads them, ordered by PandaID and cut
  at 1000 rows with truncated, and the number of jobs by jobStatus from a
  second statement.
- jobsArchived4 and the archive are read in a window on modificationTime:
  from since, or from the creation of the task, less 10 minutes and down to
  the day, up to the day after the database time, which leaves out the
  partitions made ahead. The index lookups of both statements are held to
  db_read_probe_budget, and a call over it is refused.
- GET /v1/task/get_dataset_rows returns every JEDI_Datasets column of the
  task, cut at 1000 rows.
- Both give as_of, like the other history and key reads.
task/get_job_rows returns at most 1000 rows, and the harness already sees
tasks with 1002-2464 live rows plus archived ones. after_panda_id returns
only the jobs with a larger PandaID, in the same order and under the same
cap, so a caller reads a task page by page until truncated is false.

The page is put on every table of the union, where the jediTaskID+PandaID
index can start from it, and since the pages are ordered over all tables a
job moving between tables from one page to the next is still read once.
The counts take no page: every call counts every job in the window.
Postgres takes the standard FETCH FIRST n ROWS ONLY as it is, so the
per-backend LIMIT branch in db_read compose and row_limit_clause() are
not needed.
task/get_dataset_rows returns at most 1000 rows, and a task with more
datasets than that could not be read past the first 1000. after_dataset_id
returns only the datasets with a larger datasetID, in the same order and
under the same cap, so a caller reads a task page by page until truncated
is false, as with after_panda_id on task/get_job_rows. Without it the
answer is as before.
@tmaeno
tmaeno merged commit 29c4e01 into PanDAWMS:master Nov 19, 2026
1 check passed
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.

1 participant