workflow#
zen_api_utils.workflow
#
Functions:
-
print_job_template–Prints the details of a job template.
-
get_job_templates–Retrieves the available job templates from the workflow service.
-
get_all_job_templates–Asynchronously retrieves all job templates from the specified workflow service.
-
get_zen_api_job_templates–Retrieves the ZEN API job templates from the specified workflow service.
-
get_resource_ids–Retrieves the available resource IDs from the job resources service.
-
is_job_template_loaded–Check if the job template is loaded.
-
is_job_running–Check if a job is currently running.
-
get_status–Get the status of a job using the provided workflow service.
-
monitor_status–Monitors the status of a workflow.
-
run_job–Runs a job using the specified workflow service and job template.
-
get_job_resource_ids–Retrieves the resource IDs of the current job.
print_job_template
#
print_job_template(job_template: JobTemplateInfo) -> None
Prints the details of a job template.
Parameters:
-
job_template(JobTemplateInfo) –The job template to print.
Returns:
-
None–None
get_job_templates
async
#
get_job_templates(workflow_service: WorkflowServiceStub, category='', subcategory='') -> List[JobTemplateInfo]
Retrieves the available job templates from the workflow service.
Parameters:
-
workflow_service(WorkflowServiceStub) –The workflow service to retrieve job templates from.
-
category(str, default:'') –The category of job templates to filter by. Defaults to "".
-
subcategory(str, default:'') –The subcategory of job templates to filter by. Defaults to "".
Returns:
-
List[JobTemplateInfo]–List[JobTemplateInfo]: A list of available job templates.
get_all_job_templates
async
#
get_all_job_templates(workflow_service: WorkflowServiceStub) -> None
Asynchronously retrieves all job templates from the specified workflow service. Parameters: - workflow_service (WorkflowServiceStub): The workflow service to retrieve job templates from. Returns: None
get_zen_api_job_templates
async
#
get_zen_api_job_templates(workflow_service: WorkflowServiceStub)
Retrieves the ZEN API job templates from the specified workflow service. Parameters: - workflow_service (WorkflowServiceStub): The workflow service to retrieve the job templates from. Returns: - List[JobTemplate]: A list of ZEN API job templates. Raises: - SomeException: If an error occurs while retrieving the job templates.
get_resource_ids
async
#
get_resource_ids(job_resources_service: JobResourcesServiceStub) -> List[str]
Retrieves the available resource IDs from the job resources service.
Parameters: - job_resources_service (JobResourcesServiceStub): The job resources service to retrieve resource IDs from.
Returns: - List[str]: A list of available resource IDs.
is_job_template_loaded
async
#
is_job_template_loaded(workflow_service: WorkflowServiceStub) -> bool
Check if the job template is loaded.
Parameters: - workflow_service (WorkflowServiceStub): The workflow service stub.
Returns: - bool: True if the job template is loaded, False otherwise.
is_job_running
async
#
is_job_running(workflow_service: WorkflowServiceStub) -> bool
Check if a job is currently running.
Parameters: - workflow_service (WorkflowServiceStub): The workflow service stub.
Returns: - bool: True if a job is running, False otherwise.
get_status
async
#
get_status(workflow_service: WorkflowServiceStub) -> JobStatus
Get the status of a job using the provided workflow service.
Parameters: - workflow_service (WorkflowServiceStub): The workflow service to use for retrieving the status.
Returns: - JobStatus: The status of the job.
monitor_status
async
#
monitor_status(workflow_service: WorkflowServiceStub) -> None
Monitors the status of a workflow. Args: workflow_service (WorkflowServiceStub): The workflow service stub. Returns: None
run_job
async
#
run_job(workflow_service: WorkflowServiceStub, job_template_name: str, job_resources_service: Optional[JobResourcesServiceStub] = None, parameters: Optional[Dict] = None, result_path: Optional[str] = None, verbose: bool = False) -> None
Runs a job using the specified workflow service and job template. Args: workflow_service (WorkflowServiceStub): The workflow service to use for running the job. job_template_name (str): The name of the job template to load. job_resources_service (Optional[JobResourcesServiceStub], optional): The job resources service to use for modifying job parameters. Defaults to None. parameters (Optional[Dict], optional): The parameters to modify in the job template. Defaults to None. result_path (Optional[str], optional): The result path for the job template. Defaults to None. verbose (bool, optional): Whether to log additional information during the job execution. Defaults to False. Raises: TypeError: If the type of a parameter is not supported. Returns: None: This function does not return anything.
get_job_resource_ids
async
#
get_job_resource_ids(job_resources_service: JobResourcesServiceStub) -> List[str]
Retrieves the resource IDs of the current job. Parameters: - job_resources_service: An instance of JobResourcesServiceGetAvailableResourcesRequest. Returns: - A list of resource IDs.