calypso.dispatchers.orchestrator.scheduler.shell module

class calypso.dispatchers.orchestrator.scheduler.shell.Shell(name: str, executor: BaseExecutor, **kwargs)

Bases: BaseScheduler

generate_job_script(job: Job)

The outer interface to generate script according to the job.

Parameters:

job (Job) – A dict containing job information

Examples

>>> job = Job(
        name=name,
        job=job,
        job_id=None,
        state=JobStatus.unsubmitted,
        remote_root=machine.remoteroot,
        local_root=machine.localroot,
        machine_idx=machine.machine_idx,
    }
Returns:

The shell script of this job.

Return type:

str

generate_task_env()

Env variables should be considered in this func for script.

Returns:

env varibles command line.

Return type:

str

generate_task_head(name: str)
generate_task_script(jobs: list[Job], submit_script_name: str)
kill(job: Job)

kill a job and related child processes according to given job id.

Parameters:

job (int) – job id to be killed.

Returns:

tuple contains output, error and return code.

Return type:

tuple

Raises:

RuntimeError – error occurs when return code is not zero.

query(job: Job)

check the job state. First is to check if the job is finished according to a file tag, if not, check the status according to the job id.

Parameters:

job (dict) – A dict containing job information.

Returns:

JobStatus – return job status.

Return type:

JobStatus

Raises:

RuntimeError – error occurs when return code is not zero.

submit(jobs: list[Job], timeout=3600)

submit job and return the job id, raise error if return code is not zero.

Parameters:

jobs (dict) – A dict containing job information

Returns:

job_id – Parent job id.

Return type:

int

Raises:

RuntimeError – Error occurs if return code is not zero.