gc3utils.commands

Implementation of the core command-line front-ends.

class gc3utils.commands.cmd_gclean(**extra_args)

Permanently remove jobs from local and remote storage.

In normal operation, only jobs that are in a terminal status can be removed; if you want to force gclean to remove a job that is not in any one of those states, add the -f option to the command line.

If a job description cannot be successfully read, the corresponding job will not be deleted; use the -f option to force removal of a job regardless.

class gc3utils.commands.cmd_gcloud(**extra_args)

gcloud manage VMs created by the EC2 backend

Usage:

gcloud command [options]

commands are listed below, under subcommands.

To get detailed info on a specific command, run:

gcloud command –help
class gc3utils.commands.cmd_gget(**extra_args)

Retrieve output files of a job.

Output files can only be retrieved once a job has reached the ‘RUNNING’ state; this command will print an error message if no output files are available.

Output files can be retrieved multiple times until a job reaches ‘TERMINATED’ state: after that, the remote storage will be released once the output files have been fetched.

class gc3utils.commands.cmd_ginfo(**extra_args)

Print detailed information about a job.

A complete dump of all the information known about jobs listed on the command line is printed; this will only make sense if you know GC3Libs internals.

class gc3utils.commands.cmd_gkill(**extra_args)

Cancel a submitted job. Given a list of jobs, try to cancel each one of them; exit with code 0 if all jobs were cancelled successfully, and 1 if some job was not.

The command will print an error message if a job cannot be canceled because it’s in NEW or TERMINATED state, or if some other error occurred.

class gc3utils.commands.cmd_gresub(**extra_args)

Resubmit an already-submitted job with (possibly) different parameters.

If you resubmit a job that is not in terminal state, the existing job is canceled before re-submission.

class gc3utils.commands.cmd_gselect(**extra_args)

Select job IDs based on specific criteria

filter_by_iofile(job_list, ifile=None, ofile=None)

Filter job_list based on the basename of their input or output files. It will return any file which matches both ifile and ofile.

Returns an updated job list.

filter_by_regexp(job_list, regexp, attribute='jobname')

Filter job_list by selecting only the jobs which attribute attribute match the supplied regexp.

Returns an updated job list.

filter_by_state(job_list)

Filter job_list by selecting only the jobs which match the desired state(s).

Returns an updated job list.

filter_by_submission_date(job_list)

Filter job_list by submission date. Only job which have been submitted within the range specified by command line will be selected.

Returns an updated job list.

class gc3utils.commands.cmd_gservers(**extra_args)

List status of computational resources.

setup()

Override GC3UtilsScript setup method since we don’t need any session argument.

setup_args()

Override GC3UtilsScript setup_args method since we don’t operate on jobs but on resources.

class gc3utils.commands.cmd_gsession(**extra_args)

gsession get info on a session.

Usage:

gsession command [options] SESSION_DIR

commands are listed below, under subcommands.

To get detailed info on a specific command, run:

gsession command –help
abort_session()

Called with subcommand abort.

This method will open the desired session and will kill all the jobs which belongs to that session.

Thiw method will return the number of jobs that have not been correctly aborted. If this number is greater than 125, then 125 will be returned instead, since numbers above 125 have a special meaning for the shell.

delete_session()

Called with subcommand delete.

This method will first call abort and then remove the current session.

If the abort will fail or not all tasks are in TERMINATED state, it will not delete the session and will exit with the exit status of the abort.

list_jobs()

Called when subcommand is list.

This method basically call the command “gstat -n -v -s SESSION”

show_log()

Called when subcommand is log.

This method will print the history of the jobs in SESSION in a logfile fashon

class gc3utils.commands.cmd_gstat(**extra_args)

Print job state.

class gc3utils.commands.cmd_gtail(**extra_args)

Display the last lines from a job’s standard output or error stream. Optionally, keep running and displaying the last part of the file as more lines are written to the given stream.

setup_args()

Override GC3UtilsScript setup_args method since we don’t operate on single jobs.