get_jobs(host=None, user=None, **kwargs)

Fetches a list of all of the cron jobs, excluding deleted jobs by default.

Optionally filters by host or username if these parameters are supplied. Other keyword arguments (e.g. include_deleted, crabid, command, without_crabid) are passed to the _get_jobs method.


Mark a job as deleted.


Remove deletion mark from a job.

update_job(id_, **kwargs)

Updates job information.

Keyword arguments are passed on to the private _update_job method, and can include: crabid, command, time, timezone.

log_start(host, user, crabid, command)

Inserts a job start record into the database.

Returns a dictionary including a boolean value indicating whether the job inhibit setting is active or not.

log_finish(host, user, crabid, command, status, stdout=None, stderr=None)

Inserts a job finish record into the database.

The output will be passed to the write_job_output method, unless both stdout and stderr are empty.


Retrieve configuration data for a job by ID number.

write_job_output(finishid, host, user, id_, crabid, stdout, stderr)

Writes the job output to the store.

This will use the outputstore’s corresponding method if it is defined, otherwise it writes to this store.

get_job_output(finishid, host, user, id_, crabid)

Fetches the standard output and standard error for the given finish ID.

The result is returned as a two element list. Returns a pair of empty strings if no output is found.

This will use the outputstore’s corresponding method if it is defined, otherwise it reads from this store.

get_crontab(host, user)

Fetches the job entries for a particular host and user and builds a crontab style representation.

Please see crab.util.crontab.write_crontab for more details of how the crontab is constructed.

save_crontab(host, user, crontab, timezone=None, allow_filter=True)

Takes a list of crontab lines and uses them to update the job records.

It looks for the CRABID and CRON_TZ variables, but otherwise ignores everything except command lines. It also checks for commands starting with a CRABID= definition, but otherwise inserts them into the database as is.

If “allow_filter” is True (as is the default) then cron jobs are skipped if they have a specified user name or client host name which does not match the given host or user name.

Returns a list of warning strings.

check_job(*args, **kwargs)

Ensure that a job exists in the store.

Acquires the lock and then calls the private _check_job method.

write_raw_crontab(host, user, crontab)
get_raw_crontab(host, user)


Store class for cron job output.

This backend currently implements only the write_job_output and get_job_output methods, to allow it to be used as an “outputstore” along with CrabStoreDB.

write_job_output(finishid, host, user, id_, crabid, stdout, stderr)

Write the cron job output to a file.

The only parameter required to uniquely identify the event associated with this output is the “finishid”, but the host, user and job identifiers are also provided to allow hierarchical storage.

Only writes a stdout file (extension set by self.outext, by default txt), and a stderr file (extension self.errext, default err) if they are not empty.

get_job_output(finishid, host, user, id_, crabid)

Find the file containing the cron job output and read it.

As for write_job_output, only the “finishid” is logically required, but this method makes use of the host, user and job identifiers to read from a directory hierarchy.

Requires there to be an stdout file but allows the stderr file to be absent.

write_raw_crontab(host, user, crontab)

Writes the given crontab to a file.

get_raw_crontab(host, user)

Reads the given user’s crontab from a file.