LaunchAgent

class LaunchAgent

Launch agent class which polls run given run queues and launches runs for wandb launch.

method LaunchAgent.__init__

__init__(api: wandb.apis.internal.Api, config: Dict[str, Any])

Initialize a launch agent.

Arguments:

  • api: Api object to use for making requests to the backend.
  • config: Config dictionary for the agent.

property LaunchAgent.num_running_jobs

Return the number of jobs not including schedulers.


property LaunchAgent.num_running_schedulers

Return just the number of schedulers.


property LaunchAgent.thread_ids

Returns a list of keys running thread ids for the agent.


method LaunchAgent.check_sweep_state

check_sweep_state(
    launch_spec: Dict[str, Any],
    api: wandb.apis.internal.Api
)  None

Check the state of a sweep before launching a run for the sweep.


method LaunchAgent.fail_run_queue_item

fail_run_queue_item(
    run_queue_item_id: str,
    message: str,
    phase: str,
    files: Optional[List[str]] = None
)  None

method LaunchAgent.finish_thread_id

finish_thread_id(
    thread_id: int,
    exception: Optional[Exception, wandb.sdk.launch.errors.LaunchDockerError] = None
)  None

Removes the job from our list for now.


method LaunchAgent.get_job_and_queue

get_job_and_queue()  Optional[wandb.sdk.launch.agent.agent.JobSpecAndQueue]

classmethod LaunchAgent.initialized

initialized()  bool

Return whether the agent is initialized.


method LaunchAgent.loop

loop()  None

Loop infinitely to poll for jobs and run them.

Raises:

  • KeyboardInterrupt: if the agent is requested to stop.

classmethod LaunchAgent.name

name()  str

Return the name of the agent.


method LaunchAgent.pop_from_queue

pop_from_queue(queue: str)  Any

Pops an item off the runqueue to run as a job.

Arguments:

  • queue: Queue to pop from.

Returns: Item popped off the queue.

Raises:

  • Exception: if there is an error popping from the queue.

method LaunchAgent.print_status

print_status()  None

Prints the current status of the agent.


method LaunchAgent.run_job

run_job(
    job: Dict[str, Any],
    queue: str,
    file_saver: wandb.sdk.launch.agent.run_queue_item_file_saver.RunQueueItemFileSaver
)  None

Set up project and run the job.

Arguments:

  • job: Job to run.

method LaunchAgent.task_run_job

task_run_job(
    launch_spec: Dict[str, Any],
    job: Dict[str, Any],
    default_config: Dict[str, Any],
    api: wandb.apis.internal.Api,
    job_tracker: wandb.sdk.launch.agent.job_status_tracker.JobAndRunStatusTracker
)  None

method LaunchAgent.update_status

update_status(status: str)  None

Update the status of the agent.

Arguments:

  • status: Status to update the agent to.