km3pipe.shell

Some shell helpers

Module Contents

Classes

Script

A shell script which can be built line by line for qsub.

Functions

qsub(script, job_name[, dryrun, silent])

Submit a job via qsub.

submit(script, job_name[, dryrun, silent])

Submit a job.

gen_job(script, job_name[, log_path, group, walltime, ...])

get_jpp_env(jpp_dir)

Return the environment dict of a loaded Jpp env.

Attributes

log

BATCH_TYPE

SUBMIT_CMD

JOB_TEMPLATES

km3pipe.shell.log[source]
km3pipe.shell.BATCH_TYPE[source]
km3pipe.shell.SUBMIT_CMD[source]
km3pipe.shell.JOB_TEMPLATES[source]
km3pipe.shell.qsub(script, job_name, dryrun=False, silent=False, *args, **kwargs)[source]

Submit a job via qsub.

Returns the job script as string.

km3pipe.shell.submit(script, job_name, dryrun=False, silent=False, *args, **kwargs)[source]

Submit a job.

Returns the job script as string.

km3pipe.shell.gen_job(script, job_name, log_path='qlogs', group='km3net', walltime='00:10:00', nodes=1, ppn=4, node_type=None, cluster='in2p3', memory='3G', email=None, send_mail='n', job_array_start=1, job_array_stop=None, job_array_step=1, irods=False, sps=True, hpss=False, xrootd=False, dcache=False, oracle=False, split_array_logs=False)[source]
km3pipe.shell.get_jpp_env(jpp_dir)[source]

Return the environment dict of a loaded Jpp env.

The returned env can be passed to subprocess.Popen(“J…”, env=env) to execute Jpp commands.

class km3pipe.shell.Script[source]

A shell script which can be built line by line for qsub.

add(line)[source]

Add a new line

echo(text)[source]

Add an echo command. The given text will be double qouted.

separator(character='=', length=42)[source]

Add a visual separator.

cp(source, target)[source]

Add a new copy instruction

mv(source, target)[source]

Add a new move instruction

mkdir(folder_path)[source]

Add a new ‘mkdir -p’ instruction

iget(irods_path, attempts=1, pause=15)[source]

Add an iget command to retrieve a file from iRODS.

Parameters:
irods_path: str

Filepath which should be fetched using iget

attempts: int (default: 1)

Number of retries, if iRODS access fails

pause: int (default: 15)

Pause between two access attempts in seconds

clear()[source]