XAS::Lib::Batch::Job - A class for the XAS environment
use XAS::Lib::Batch::Job; my $job = XAS::Lib::Batch::Job->new(); my $id = $job->qsub(...); printf("job %s has started\n", $id); while (my $stat = $job->qstat(-job => $id)) { if ($stat->{job_state} eq 'C') { printf("job %s has finished\n", $id); } sleep 10; }
This module provides an interface for manipulating jobs in a Batch System. Each available method is a wrapper around a given command. A command line is built, executed, and the return code is checked. If the return code is non-zero an exception is thrown. The exception will include the return code and the first line from stderr.
Since each method is a wrapper, there is a corresponding man page for the actual command. They should also be checked when problems arise.
This method initializes the module and takes these parameters:
The command line interface to use. This defaults to 'XAS::Lib::Batch::Interface::Torque'.
This method will submit a job to the batch system and returns the jobs ID. It takes the following parameters:
The name of the job.
The queue to run the job on.
The email address to send status reports too. There can be more then one address or this can be a mailing list.
The command to run.
The name of the job file to use. This needs to be a Badger::Filesystem::File object.
The log file to use. This needs to be a Badger::Filesystem::File object.
Wither the job is rerunnable, this is optional and default to no.
Wither to join stdout and stderr into one log file, this is optional and defaults to 'oe'.
The optional account to run under.
The optinal attributes that may be applied to this job. This should be a comma seperated list of name value pairs.
The optional environment variables that may be defined for the job. This should be a comma sperated list of name value pairs.
Wither to export the users environment.
The option to run this job exclusivily. Default is no.
The option to submit this job in a hold state.
Optional resources to associate with this job. This should be a comma seperated list of name value pairs.
The optional user account to run this job under.
The optional host to run this job on.
The optional mail points that the user will be notified at. Defaults to 'bea'.
The optional time to run the job after. This must be a DateTime object.
The optional path to the jobs shell. Defaults to /bin/sh.
The optional path to put work files. This must be a Badger::Filesystem::Directory. Defaults to /tmp.
The optional priority to run the job at. Defaults to 0.
This method returns that status of a job. This status will be a hash reference of the parsed output on stdout. It takes the following paramters:
The ID of the job, as returned from submit().
The optional host that the job may be running on. Defaults to 'localhost'.
This method will delete a job. It takes the following parameters:
Wither to force the jobs deletion. Defaults to no.
The optional message to be placed into the log file.
This method will send a signal to a job. It takes the following parameters:
The signal to send to the job.
This method will place a job into a hold status. It takes the following parameters:
The type of hold to place on the job. They can be any of the following:
user, other, system, none
If more then one type is used, they need to be comma seperated.
This method will release a job that was placed into a hold status. It takes the following parameters:
This method will move a job from one queue to another. That queue may exist on another host. It takes the following parameters:
The queue to move the job too.
The optional destination host that the queue is on.
This method will place a message into the log file of a job. It takes the following parameters:
The message to be used.
The log to place the message, It can be one of the following:
E - stderr O - stdout
This method will attempt to rerun a job. It takes the following parameters:
This method will alter the parameters of a job. It takes the following parameters:
This will change the jobs name.
This will change the jobs rerunable status.
This will change the jobs email destinations.
This will change the jobs account.
This will change the optional job attributes.
This will change wither the job has exclusive access to the server.
This will change the jobs optional resources.
This will change the jobs user.
This will change the jobs mail points.
This will change the jobs shell.
This will hold the job.
This will change the jobs join path.
This will change the time that job will run after.
This will changes the jobs output path, it must be a Badger::Filesystem::File object.
This will changes the jobs error path, it must be a Badger::Filesystem::File object.
This will change the jobs priority.
Kevin L. Esteb, <kevin@kesteb.us>
Copyright (c) 2015 Kevin L. Esteb
This is free software; you can redistribute it and/or modify it under the terms of the Artistic License 2.0. For details, see the full text of the license at http://www.perlfoundation.org/artistic_license_2_0.
To install XAS, copy and paste the appropriate command in to your terminal.
cpanm
cpanm XAS
CPAN shell
perl -MCPAN -e shell install XAS
For more information on module installation, please visit the detailed CPAN module installation guide.