Skip to main content

Perl API Reference

qb::block

PurposeSets job state to blocked.
Prototypeqb::block(ids)
Parametersidsa list of job or subjob ids.

Example

use lib "$ENV{QBDIR}/api/perl";
use qb;qb::block(@ids)

qb::bottom

PurposeMoves jobs to end of execution order queue.
Prototypeqb::bottom(ids)
Parametersidsa list of job or subjob ids

Example

use lib "$ENV{QBDIR}/api/perl";
use qb;

qb::bottom(@ids)

qb::genchunks

PurposeGenerates a work agenda based on an input frame specification divided into fixed width chunks
Prototypeqb::genchunks(chunksize , range)
Parameterschunksizenumber of frames in a single chunk
rangeframe range format string. See qb::rangesplit() for range format.
ResultReference to a work agenda hash

Example

use lib "$ENV{QBDIR}/api/perl";
use qb;

my $frames = qb::genchunks(5, "1-100");

qb::genframes

PurposeGenerates a work agenda based on an frame specification string
Prototypeqb::genframes(range)
ParametersrangeFrame range format string. See qb::rangesplit() for range format
ResultReference to a work agenda hash.

Example

use lib "$ENV{QBDIR}/api/perl";
use qb;

my $frames = qb::genframes("1-100");

qb::hist

PurposeReturns a list of history objects corresponding to the job query
Prototypeqb::hist(ids)
ParametersidsJob or subjob ids.
ResultReference to a array of hash references containing history information:
"comment": comment string
"stamp": timestamp
"jobid": job ID
"subid": subjob ID

Example

use lib "$ENV{QBDIR}/api/perl";
use qb;

qb::hist(@ids)

qb::hostinfo

PurposeReturns information from list of hosts
Prototypeqb::hostinfo(query)
ParametersqueryHash containing host query information
ResultsArray of hash references containing information about hosts meeting query:
"name": host name
"address": host IP address
"state": host state
"cluster": host cluster membership
"groups": host group membership
"stats": host statistics
"properties": Worker properties for host
"resources": Worker resources for host
"restrictions": host restrictions

Example

use lib "$ENV{QBDIR}/api/perl";
use qb;

qb::hostinfo(%query)

qb::interrupt

PurposeForces running jobs back to pending state immediately.
Prototypeqb::interrupt(ids)
Parametersidsa list of job or subjob ids.

Example

use lib "$ENV{QBDIR}/api/perl";
use qb;

qb::interrupt(@ids)

qb::jobinfo

PurposeGenerates a list of job objects matching query filter
Prototypeqb::jobinfo(query)
ParametersqueryHash containing job query parameters.
ResultReference to an array of hashes containing information regarding jobs that meet the query (all jobs if no query):
"prototype": job type
"ID": job ID
"priority": job priority
"user": job owner
"label": job label
"account": job accounting
"pid": process ID
"pgrp": process group
"cpus": cpus
"reservations": job reservations
"requirements": job requirements
"restrictions": job restrictions
"cluster": job cluster
"hosts": job hosts
"groups": host groups
"name": job name
"package": job package data hash reference
"data": job package data string
"status": current job status

Example

use lib "$ENV{QBDIR}/api/perl";
use qb;

qb::jobinfo(%query)

qb::joborder

PurposeReturns a list of jobs eligible to run on specified hosts
Prototypeqb::joborder(host)
Parametershosthost name
ResultsReference to an array of hashes containing job information for jobs scheduled to run on host:
"prototype": job type
"ID": job ID
"priority": job priority
"user": job owner
"label": job label
"account": job accounting
"pid": process ID
"pgrp": process group
"cpus": cpus
"reservations": job reservations
"requirements": job requirements
"restrictions": job restrictions
"cluster": job cluster
"hosts": job hosts
"groups": host groups
"name": job name
"package": job package data hash reference
"data": job package data string
"status": current job status

Example

use lib "$ENV{QBDIR}/api/perl";
use qb;

qb::joborder($host)

qb::kill

PurposeKills jobs
Prototypeqb::kill(ids)
Parametersidslist of job or subjob ids.

Example

use lib "$ENV{QBDIR}/api/perl";
use qb;

qb::kill(@ids)

qb::migrate

PurposeInterrupt a running job and force to run on a different host
Prototypeqb::migrate(ids)
Parametersidsa list of job or subjob ids.
Result

Example

use lib "$ENV{QBDIR}/api/perl";
use qb;

qb::migrate(@ids)

qb::modify

Purposemodifies job parameters
Prototypeqb::modify(parameters , ids)
ParametersparametersHash containing job parameters and new values
idslist of job or subjob ids to be modified

Example

use lib "$ENV{QBDIR}/api/perl";
use qb;qb::modify({ priority => 1, name => "hello world" }, 1002);

qb::preempt

PurposeForces running jobs back to pending state after agenda item is completed
Prototypeqb::preempt(ids)
Parametersidslist of job or subjob ids
CommentsWill release host gracefully if Job Type supports an agenda

Example

use lib "$ENV{QBDIR}/api/perl";
use qb;

qb::preempt(@ids)

qb::rangechunk

PurposeConverts an frame range format into an array of frame ranges of a specified length
Prototypeqb::rangechunk(chunksize , range)
ParameterschunksizeNumber of frames in a single chunk
rangeFrame range format string. See qb::rangesplit() for range format
ResultList containing the individual frames in mode order

Example

use lib "$ENV{QBDIR}/api/perl";
use qb;

qb::rangechunk($chunksize, $range)

qb::rangejoin

PurposeConverts a list of frames into frame range format string
Prototypeqb::rangejoin(frames)
ParametersframesList of frames
ResultFrame range format string corresponding to the frame list

Example

use lib "$ENV{QBDIR}/api/perl";
use qb;

my $range = qb::rangejoin(1,2,3,4,5);result: $range = "1-5";
my $range = qb::rangejoin(1,3,5,7,9,11,13);

result: $range = "1-13x2";

qb::rangeorder

PurposeTakes an input range and converts it into an array of individual numbers sorted/ordered in the method specified
Prototypeqb::rangeorder(mode , range)
ParametersmodeSort order mode.Valid modes:
1. binary,
2. reverse
3. rawbinary
4. ascend
5. descend
rangeFrame range format string.
See qb::rangesplit() for range format
ResultList containing the individual frames in mode order

Example

use lib "$ENV{QBDIR}/api/perl";
use qb;qb::rangeorder($mode, $range)

qb::rangesplit

PurposeTakes an input range and converts it into an array of individual numbers
Prototypeqb::rangesplit(range)
ParametersrangeFrame range format string
Resultslist of individual frame numbers
CommentsRange Format:
<start><end>x<step>[,<start><end>x<step>...]
Ex. 1-10x2,12,20

Example

use lib "$ENV{QBDIR}/api/perl";
use qb;

my @frame_numbers = qb::rangesplit("1-100");
result: @frame_numbers = (1,2,3,4..98,99,100);

my @frame_numbers = qb::rangesplit("1-100x10");
result: @frame_numbers = (1,11,21,31,41,51,61,71,81,91);

my @frame_numbers = qb::rangesplit("10-10");
result: @frame_numbers = (-10,-9,-8,-7..6,7,8,9,10);

my @frame_numbers = qb::rangesplit("-10-5");
result: @frame_numbers = (-10,-9,-8,-7,-6,-5);

my @frame_numbers = qb::rangesplit("1-5x2,10-12");
result: @frame_numbers = (1,3,5,10,11,12);

qb::remove

PurposeRemoves jobs from the Supervisor database cache
Prototypeqb::remove(ids)
Parametersidslist of job or subjob ids

Example

use lib "$ENV{QBDIR}/api/perl";
use qb;qb::remove(@ids)

qb::requeue

PurposeResets a failed, complete or killed job back to a initial blocked state
Prototypeqb::requeue(ids)
Parametersidsa list of job or subjob ids

Example

use lib "$ENV{QBDIR}/api/perl";
use qb;qb::requeue(@ids)

qb::resource

PurposeQueries Supervisor for state of resources
Prototypeqbresource(resources)
ParametersresourcesHash describing resource keys and values

Example

use lib "$ENV{QBDIR}/api/perl";
use qb;

qbresource(%resources)

qb::resume

Purposeresumes suspended jobs
Prototypeqb::resume(ids)
Parametersidsa list of job or subjob ids.

Example

use lib "$ENV{QBDIR}/api/perl";
use qb;qb::resume(ids)

qb::retry

Prototypeqb::retry(ids)
Parametersidsa list of job or subjob ids

Example

use lib "$ENV{QBDIR}/api/perl";
use qb;qb::retry(@ids)

qb::stderr

PurposeRetrieves job STDERR log file output
Prototypeqb::stderr(ids)
Parametersidslist of job or subjob ids
ResultsArray of hash references referring to the STDERR logs:
"data": log file contents
"jobid": job ID
"subid": subjob ID

Example

use lib "$ENV{QBDIR}/api/perl";
use qb;qb::stderr(@ids)

qb::stdout

PurposeRetrieves job STDOUT log file output
Prototypeqb::stderr(ids)
Parametersidslist of job or subjob ids
ResultsArray of hash references referring to the STDOUT logs
CommentsHash contains keys:
"data": log file contents
"subid": subjob ID
"jobid": job ID

Example

use lib "$ENV{QBDIR}/api/perl";
use qb;

qb::stderr(@ids)

qb::submit

PurposeSubmits a list of jobs to be dispatched by the Supervisor
Prototypeqb::submit(job)
ParametersjobHash reference containing the job parameters. Must contain at minimum a $job{prototype} value containing the Job Type to execute
Results$_ is a pointer to the job hash.$_->{ID} is the ID of the submitted job

Example

use lib "$ENV{QBDIR}/api/perl";
use qb;

my $job = { "name" => "job name", "priority" => "12433", "cluster" =>
"/project/rnd", "requirements" => "host.name == qb003 \ and host.os eq Linux",
"prototype" => "cmdline", "package" => {"cmdline" => "sleep 100"}};

qb::submit($job)

qb::submitcallback

PurposeSubmit a job callback to be executed on certain events
Prototypeqb::submit(callback)
ParameterscallbackHash containing the callback parameters.

Example

use lib "$ENV{QBDIR}/api/perl";
use qb;
qb::submit(%callback)

qb::suspend

PurposeSends the SUSPEND signal to running jobs
Prototypeqb::suspend(ids)
Parametersidsa list of job or subjob ids

Example

use lib "$ENV{QBDIR}/api/perl";
use qb;

qb::suspend(@ids)

qb::top

PurposeMoves jobs to the head of execution order queue
Prototypeqb::top(ids)
Parametersidsa list of job or subjob ids.

Example

use lib "$ENV{QBDIR}/api/perl";
use qb;

qb::top(@ids)

qb::unblock

PurposeUnblocks jobs so they can begin executing when hosts become available
Prototypeqb::unblock(ids)
Parametersidsa list of job or subjob ids.

Example

use lib "$ENV{QBDIR}/api/perl";
use qb;

qb::unblock(@ids)