CamberJob

The job module contains the CamberJob class, a low level interface create jobs on the CamberCloud platform. This doc is split into class methods and instance methods sections. For a reference of the attributes that can belong to a specific job object, refer to Engine attributes.

ℹ️
The users are not expected to use CamberJob class methods directly, since higher level methods are available through the likes of camber.mpi. Feel free to jump over the class methods section to see what instance methods are available. That said, understanding CamberJob class methods can be important to understanding how jobs are created and managed on CamberCloud.

Class methods

The following methods are class methods that operate on the CamberJob class itself, i.e. CamberJob.method().

create

Creates a new job on CamberCloud.

job = CamberJob.create(
    engine_size="XSMALL",
    engine_type="MPI",
    command="mpirun -np 2 athena/bin/athena -i athinput.orszag-tang",
    tags=["athena", "input1"]
)

Args

engine_size: str
Size of engine to use.
e.g. XSMALL
engine_type: str
Type of engine to use.
e.g. MPI
command: str
Command to run.
mount_dir: Optional[str]
Directory to mount.
extra_env_vars: Optional[Dict[str, str]]
Extra environment variables to set.
e.g. {"MY_ENV_VAR":"my_value"}
extra_mount_dirs: Optional[dict]
Additional directories to mount.
image_tag: Optional[str]
Image tag to use.
num_engines: Optional[int]
Number of engines to use.
with_gpu: bool
Whether to use GPU.
tags: Union[str, List]
Tags to add to the job.
e.g. ["tag1", "tag2"] or "tag1".

Returns

CamberJob
The CamberJob object representing the created job.

get

Gets your existing job from Camber by job_id, and optionally by engine_type. If no job is found, returns None.

Args

job_id: Union[str, int]
The id of the job to get.
engine_type: Optional[str]
Optional engine type to filter by.
e.g. MPI

Returns

Optional[CamberJob]
The CamberJob object if found, None otherwise.

list

Lists all your existing CamberJob objects.

Args

engine_type: Optional[str]
Optional engine type to filter by.
e.g. MPI
tags: Optional[Union[str, List]]
Optional tags to filter by.
e.g. ["tag1", "tag2"] or "tag1".

Returns

List[CamberJob]
A list of CamberJob objects.

Instance methods

clear

Deletes a CamberJob. If the job is still running, it will be forcefully terminated, resulting in a CANCELLED status.

download_log

Downloads the log file of the job instance to the specified directory. Default save directory is the current working directory.

Args

save_dir: str
Directory to save the log file to.

read_logs

Reads the logs of the job instance. You can specify the number of lines to read from the head or tail of the logs.

Args

head_lines: Optional[int]
Number of lines to read from the head of the logs.
tail_lines: Optional[int]
Number of lines to read from the tail of the logs.