Repository navigation
Record task command logs and fix nGBPerJob handling - #874
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
task_api.pythat 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]get_command_history, to retrieve the command history for a given task, including detailed metadata about each command and its status.get_command_historyendpoint, ensuring it returns the expected structure and data.Supporting Changes and Improvements:
common.pyto support command logging, such as limits for argument and response size, and logic for extracting task IDs from endpoint arguments. [1] [2]Other Minor Updates:
reload_inputendpoint to clarify requirements.JediDBSchemaInfo.pyto reflect the new features.