Crab Client API

crab.client module

class crab.client.CrabClient(command=None, crabid=None)

Crab client class, used for interaction with the server.

__init__(command=None, crabid=None)

Constructor for CrabClient.

This causes the client to configure itself, by looking for the crab.ini file. If the environment variables CRABHOST or CRABPORT exist, these override settings from the configuration files.

If the client has been started to report on the status of a job, then the command must be supplied, and the crabid should be given if known.

start()

Notify the server that the job is starting.

Return the decoded server response, which may include an inhibit dictionary item.

finish(status=2, stdoutdata='', stderrdata='')

Notify the server that the job is finishing.

send_crontab(crontab, timezone=None)

Takes the crontab as a string, breaks it into lines, and transmits it to the server.

Returns a list of warnings.

fetch_crontab(raw=False)

Retrieves crontab lines from the server, and returns them as a single string.

get_info()
__module__ = 'crab.client'

crab module

exception crab.CrabError

Base class for exceptions raised internally by crab.

Library functions should re-raise expected exceptions as a CrabError to allow them to be trapped conveniently without accidentally trapping other errors.

class crab.CrabStatus

Helper class for status codes.

The crab libraries should refer to codes by the symbolic names given in this class.

VALUES is the set of status codes which should be accepted from a client. Other codes are for internal use, such as those generated by the monitor.

SUCCESS = 0
FAIL = 1
UNKNOWN = 2
COULDNOTSTART = 3
ALREADYRUNNING = 4
WARNING = 5
INHIBITED = 6
WATCHDOG = 7
VALUES = set([0, 1, 2, 3, 4, 5, 6, 7])
LATE = -1
MISSED = -2
TIMEOUT = -3
CLEARED = -4
INTERNAL_VALUES = set([-4, -3, -2, -1])
static get_name(status)

Returns a readable name for the given status code.

static is_trivial(status)

Determines whether a status code is trivial and should mostly be ignored.

static is_ok(status)

Returns true if the code does not indicate any kind of problem.

static is_warning(status)

True if the given status is some kind of warning.

static is_error(status)

True if the given status is an error, i.e. not OK and not a warning.

class crab.CrabEvent

Helper class for crab events.

Currently just provides symbolic names for the event types.

START = 1
ALARM = 2
FINISH = 3
static get_name(event)

Returns a readable name for the given event type code.