client.array

Attributes

logger

Classes

Array

Representation of a client array object.

Module Contents

client.array.logger
class client.array.Array(task_template_version: jobmon.client.task_template_version.TaskTemplateVersion, task_args: Dict[str, Any], op_args: Dict[str, Any], cluster_name: str, max_concurrently_running: int = MaxConcurrentlyRunning.MAXCONCURRENTLYRUNNING, upstream_tasks: List[jobmon.client.task.Task] | None = None, compute_resources: Dict[str, Any] | None = None, compute_resources_callable: Callable | None = None, resource_scales: Dict[str, float] | None = None, name: str | None = None, requester: jobmon.core.requester.Requester | None = None, max_attempts: int | None = None)

Representation of a client array object.

Supports functionality to create tasks from the cross product of provided node_args.

Initialize the array object.

compute_resources_callable: Callable[Ellipsis, Any] | None
max_concurrently_running: int
task_template_version
task_args
op_args
upstream_tasks = None
requester = None
tasks: Dict[int, jobmon.client.task.Task]
property name: str

Return the array name.

property is_bound: bool

If the array has been bound to the db.

property array_id: int

If the array is bound then it will have been given an id.

property compute_resources: Dict[str, Any]

A dictionary that includes the users requested resources for the current run.

E.g. {cores: 1, mem: 1, runtime: 60, queue: all.q}.

property resource_scales: Dict[str, float]

A dictionary that includes the users requested resource scales for the current run.

E.g. {memory: 0.6, runtime: 0.3}.

property cluster_name: str

The name of the cluster the user wants to run their task on.

property max_attempts: int | None

Get the max_attempts.

property workflow: jobmon.client.workflow.Workflow

Get the workflow id if it has been bound to the db.

add_task(task: jobmon.client.task.Task) None

Add a task to an array.

Set semantics - add tasks once only, based on hash name.

Parameters:

task – single task to add.

create_tasks(upstream_tasks: List[jobmon.client.task.Task] | None = None, task_attributes: List | dict = {}, max_attempts: int | None = None, resource_scales: Dict[str, Any] | None = None, **node_kwargs: Any) List[jobmon.client.task.Task]

Create a task associated with the array.

Parameters:
  • upstream_tasks – Task objects that must be run prior to this one

  • task_attributes (dict or list) – attributes and their values or just the attributes that will be given values later

  • max_attempts – Number of attempts to try this task before giving up. Default is wf default.

  • resource_scales – determines the scaling factor for how aggressive resource adjustments will be scaled up

  • **node_kwargs – values for each node argument specified in command_template

Raises:

ValueError – if the args that are supplied do not match the args in the command template.

static expand_dict(**kwargs: Any) Iterator[Dict]

Expand a dictionary of iterables into combinations of values.

Given kwargs and values corresponding to node_args, return a dict of combinations of those node_args. Values of kwargs must be iterables.

get_tasks_by_node_args(**kwargs: Any) List[jobmon.client.task.Task]

Query tasks by node args. Used for setting dependencies.

validate() None
bind() None

Add an array to the database.