Skip to content

Add job/get_worker_rows for the harvester workers of a job - #880

Merged
tmaeno merged 1 commit into
PanDAWMS:masterfrom
tmaeno:master
Nov 23, 2026
Merged

tmaeno merged 1 commit into
PanDAWMS:masterfrom
tmaeno:master

Conversation

@tmaeno

@tmaeno tmaeno commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

This pull request introduces a new API endpoint to retrieve the current worker rows associated with a PanDA job, along with its backend implementation and thorough testing. The main focus is on exposing all columns from the Harvester_Workers table (plus pilot-specific columns) for a given job, with robust error handling and result truncation. The changes also include comprehensive unit and integration tests to ensure correctness.

Key changes:

API Additions and Testing

  • Added a new secure GET endpoint get_worker_rows in job_api.py to fetch all current Harvester worker rows for a given job, with documentation and structured response indicating truncation and read time. [1] [2]
  • Added integration tests and unit tests for the new endpoint, including validation of response structure, error handling, and method restrictions. [1] [2]

Backend Implementation

  • Implemented get_job_worker_rows in WorkerModule, returning all columns from Harvester_Workers (plus pilot columns), handling database errors, and supporting result truncation. [1] [2]
  • Defined JOB_WORKER_ROW_COLUMNS to specify the exact columns returned, ensuring consistency and preventing accidental overwrites.

Unit Testing

  • Added a new test suite worker_rows_tests.py with detailed tests for the backend logic, covering normal operation, truncation, error handling, and SQL generation for both Oracle and Postgres backends.

Minor Improvements

  • Imported necessary utilities and error handling helpers to support the new logic. [1] [2]

The live-case harness explains why a job stayed long in a state, and a
'starting' stay can wait on the job's harvester worker. No endpoint gives
the workers of a job, and getWorkersForJob, which Watcher uses, returns []
on a database error, the same as a job without workers.

- GET /v1/job/get_worker_rows returns the Harvester_Workers rows that
  Harvester_Rel_Jobs_Workers relates to job_id, joined as getWorkersForJob
  joins them, ordered by harvesterID and workerID and cut at 1000 rows
  with truncated, with as_of, like task/get_dataset_rows.
- Every column of the table is returned: those of WorkerSpec plus
  pilotStartTime, pilotEndTime, pilotStatus and pilotStatusSyncTime, which
  the pilot sets. They stay out of WorkerSpec, since updateWorkers sets
  every key of harvester's data that WorkerSpec has.
- A database error answers {"error": code}.
- The read touches one partition of the relations, whose PandaID index is
  local to the PandaID partitions, and the global primary key of the
  workers, so it takes no probe budget.
@tmaeno
tmaeno merged commit 7e19995 into PanDAWMS:master Nov 23, 2026
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