client.task_template_version

Task Templates are versioned to recognize changes to args and command templates.

Attributes

logger

Classes

TaskTemplateVersion

Task Templates are versioned to recognize changes to args and command templates.

Module Contents

client.task_template_version.logger
class client.task_template_version.TaskTemplateVersion(command_template: str, node_args: list, task_args: list, op_args: list, requester: jobmon.core.requester.Requester | None = None)

Task Templates are versioned to recognize changes to args and command templates.

Initialization of task template version object.

command_template
property node_args: set

Return task template version node args.

Any named arguments in command_template that make the command unique within this template for a given workflow run. Generally these are arguments that can be parallelized over.

property task_args: set

Task template version task args.

Any named arguments in command_template that make the command unique across workflows if the node args are the same as a previous workflow. Generally these are arguments about data moving though the task.

property op_args: set

Return the task template version OP args.

Any named arguments in command_template that can change without changing the identity of the task. Generally these are things like the task executable location or the verbosity of the script.

default_compute_resources_set: Dict[str, Dict[str, Any]]
default_resource_scales_set: Dict[str, Dict[str, float]]
default_cluster_name: str = ''
default_max_attempts: int | None = None
requester = None
classmethod get_task_template_version(task_template: jobmon.client.task_template.TaskTemplate, command_template: str, node_args: List[str] = [], task_args: List[str] = [], op_args: List[str] = []) TaskTemplateVersion

Get a bound TaskTemplateVersion object from parameters.

Parameters:
  • task_template – TaskTemplate this version should be associated with.

  • command_template – an abstract command representing a task, where the arguments to the command have defined names but the values are not assigned. eg: ‘{python} {script} –data {data} –para {para} {verbose}’

  • node_args – any named arguments in command_template that make the command unique within this template for a given workflow run. Generally these are arguments that can be parallelized over.

  • task_args – any named arguments in command_template that make the command unique across workflows if the node args are the same as a previous workflow. Generally these are arguments about data moving though the task.

  • op_args – any named arguments in command_template that can change without changing the identity of the task. Generally these are things like the task executable location or the verbosity of the script.

classmethod from_wire(wire_tuple: Tuple, task_template: jobmon.client.task_template.TaskTemplate) TaskTemplateVersion

Get a bound TaskTemplateVersion object from the http wire format.

Parameters:
  • task_template – TaskTemplate this version should be associated with.

  • wire_tuple – Wire format for ToolVersion defined in jobmon.serializers.

bind(task_template: jobmon.client.task_template.TaskTemplate) None

Bind task template version to the DB.

Parameters:

task_template – the TaskTemplate that this version is associated with.

property is_bound: bool

If the task template version has been bound to the database.

property task_template: jobmon.client.task_template.TaskTemplate
property id: int

The unique ID of the task template version if it has been bound.

property id_name_map: Dict[str, int]

Map of arg ids to arg names if bound to the db.

property template_args: set

The argument names in the command template.

property arg_mapping_hash: int

Hash args to identify unique task_template.

filter_kwargs(arg_type: str, **kwargs: str) Dict[str, Any]

Return the set of kwargs that are of arg_type.

Parameters:
  • arg_type – either node_args, task_args, op_args

  • kwargs – the key/value pairs to be filtered by type

convert_arg_names_to_ids(**kwargs: str) Dict[int, Any]

Map from names to ids.

update_default_compute_resources(cluster_name: str, **kwargs: Any) None

Update compute resources in place only overridding specified keys.

If no default cluster is specified when this method is called, cluster_name will become the default cluster.

Parameters:
  • cluster_name – name of cluster to modify default values for.

  • **kwargs – any key/value pair you want to update specified as an argument.

update_default_resource_scales(cluster_name: str, **kwargs: Any) None

Update resource scales in place only overridding specified keys.

If no default cluster is specified when this method is called, cluster_name will become the default cluster.

Parameters:
  • cluster_name – name of cluster to modify default values for.

  • **kwargs – any key/value pair you want to update specified as an argument.

set_default_compute_resources_from_dict(cluster_name: str, compute_resources: Dict[str, Any]) None

Set compute resources for a given cluster_name.

If no default cluster is specified when this method is called, cluster_name will become the default cluster.

Parameters:
  • cluster_name – name of cluster to set default values for.

  • compute_resources – dictionary of default compute resources to run tasks with. Can be overridden at task template or task level. dict of {resource_name: resource_value}

set_default_resource_scales_from_dict(cluster_name: str, resource_scales: Dict[str, float]) None

Set compute resources and scales for a given cluster_name.

If no default cluster is specified when this method is called, cluster_name will become the default cluster.

Parameters:
  • cluster_name – name of cluster to set default values for.

  • resource_scales – dictionary of default resource scales to adjust task resources with. Can be overridden at task level. dict of {resource_name: scale_value}

set_default_max_attempts(value: int) None

Set default max attempts at tool leve.

Parameters:

value – the default max attempts value.