client.commands.validation ========================== .. py:module:: client.commands.validation .. autoapi-nested-parse:: Validation helper functions. Helper functions for validating user permissions and workflow state: - Username validation - Workflow validation - ID chunking utilities Functions --------- .. autoapisummary:: client.commands.validation.validate_username client.commands.validation.validate_workflow client.commands.validation.chunk_ids Module Contents --------------- .. py:function:: validate_username(workflow_id: int, username: str, requester: jobmon.core.requester.Requester) -> None Validate that the user is approved to make changes to a workflow. :param workflow_id: The workflow ID to check permissions for :param username: The username to validate :param requester: Server requester object :raises AssertionError: If the user is not allowed to modify the workflow .. py:function:: validate_workflow(task_ids: List[int], requester: jobmon.core.requester.Requester) -> jobmon.core.constants.WorkflowStatus Validate that task IDs belong to a valid workflow. Validates that the task_ids provided belong to the expected workflow, and the workflow status is in expected status unless we want to force it through. :param task_ids: List of task IDs to validate :param requester: Server requester object :returns: The workflow status :raises AssertionError: If validation fails (wrong workflow status or mixed workflows) .. py:function:: chunk_ids(ids: List[int], chunk_size: int = 100) -> List[List[int]] Chunk a list of IDs into smaller lists. Useful for avoiding HTTP request size limits. :param ids: list of IDs to chunk :param chunk_size: the size of each chunk; default to 100 :returns: A list of lists, each containing at most chunk_size IDs