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=False, *args, **kwargs) Submit a job via qsub.
gen_job(script, job_name, log_path=’qlogs’, group=’km3net’, platform=’cl7’, walltime=‘00:10:00’, vmem=‘8G’, fsize=‘8G’, shell=None, 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) Generate a job script.
get_jpp_env(jpp_dir) Return the environment dict of a loaded Jpp env.
km3pipe.shell.log[source]
km3pipe.shell.JOB_TEMPLATE[source]
km3pipe.shell.qsub(script, job_name, dryrun=False, *args, **kwargs)[source]

Submit a job via qsub.

km3pipe.shell.gen_job(script, job_name, log_path='qlogs', group='km3net', platform='cl7', walltime='00:10:00', vmem='8G', fsize='8G', shell=None, 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]

Generate a job script.

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]

Bases:object

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

add(self, line)[source]

Add a new line

echo(self, text)[source]

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

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

Add a visual separator.

cp(self, source, target)[source]

Add a new copy instruction

mv(self, source, target)[source]

Add a new move instruction

mkdir(self, folder_path)[source]

Add a new ‘mkdir -p’ instruction

iget(self, 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(self)[source]