Skip to content

Record task command logs and fix nGBPerJob handling - #874

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

tmaeno merged 5 commits into
PanDAWMS:masterfrom
tmaeno:master

Conversation

@tmaeno

@tmaeno tmaeno commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

This pull request introduces a comprehensive audit trail for task-related API commands by adding command logging and retrieval to the PanDA server's task API. The main changes include recording all POST commands that act on tasks in a dedicated command log and providing a new endpoint to retrieve the command history for a given task. The implementation is careful to handle large arguments and responses, and ensures that commands are only executed if they can be logged. Additionally, a test is added to verify the new command history endpoint.

Task Command Logging and Retrieval:

  • Added a new mechanism to record all POST endpoints in task_api.py that act on tasks in the task command log (TASKS_COMMANDLOG). This includes utilities for encoding parameters and responses, and ensures commands are only executed if logging succeeds. [1] [2] [3] [4]
  • Introduced a new endpoint, get_command_history, to retrieve the command history for a given task, including detailed metadata about each command and its status.
  • Updated the test suite to add coverage for the new get_command_history endpoint, ensuring it returns the expected structure and data.

Supporting Changes and Improvements:

  • Added constants and helper functions in common.py to support command logging, such as limits for argument and response size, and logic for extracting task IDs from endpoint arguments. [1] [2]
  • Registered the task API module for command logging and ensured that all relevant endpoints are covered.

Other Minor Updates:

  • Updated documentation in the reload_input endpoint to clarify requirements.
  • Bumped the schema version in JediDBSchemaInfo.py to reflect the new features.

tmaeno and others added 5 commits November 17, 2026 11:43
Until now a task command (retry, finish, change_attribute, ...) left a trace
only in the API log of the server that took it, which is kept for about 30
days on each machine and does not say who sent it. PRODSYS_COMM keeps only
the latest command of a task, and attribute changes leave no status change in
TASKS_STATUSLOG.

- request_validation records every POST endpoint of a module registered with
  log_task_commands that names the tasks it acts on (task_id, jedi_task_id or
  task_id_list), one row per task: the endpoint, its other arguments, the
  requester, the client address and the server. task_api registers itself, so
  20 of its 21 POST endpoints are recorded without a list; submit names no
  task.
- The rows are written as received before the command runs, and the command
  is refused when they cannot be written, so every command that ran has its
  rows. The response is recorded after it, or the exception.
- For a command registered for JEDI, sendCommandTaskPanda and the incexec path
  of insertTaskParamsPanda mark the row queued, and the queued row before it
  superseded, in the transaction that writes PRODSYS_COMM. The key of the row
  reaches them in a ContextVar set by the decorator, and goes on to the
  DBProxy as an argument, since ConBridge runs it in another process.
  getTasksToExecCommand_JEDI marks the row accepted or rejected, with the
  status change or the reason, where it updates comm_cmd.
- GET /v1/task/get_command_history returns the rows of a task with as_of and
  retained_from, like get_status_history; db_read may read the table too.
- The required schema version goes to 0.1.9 for the server and JEDI. There is
  no switch: without the table, task commands fail, so the table has to be
  created before deploying.
…the refiner

pbook retry takes --nGBPerJob as a float, so a value such as 0.5 reached the
task parameters as is, and the refiner wrote NG=0.5 into splitRule. NG is read
back with NG=(\d+), so the task got 0 GB per job: JobSplitter made jobs of
the default output size alone, while other places took 0 as no limit.

- Round a float nGBPerJob down so that it stays a maximum, and raise a value
  below 1 to 1, the smallest size NG can hold. Integers from prun and pathena
  pass through unchanged.
- The task parameters keep the value as given.
@tmaeno
tmaeno merged commit 322a3fd into PanDAWMS:master Nov 18, 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