Package ganeti :: Package client :: Module gnt_job
[hide private]
[frames] | no frames]

Module gnt_job

source code

Job related commands

Functions [hide private]
int
ListJobs(opts, args)
List the jobs
source code
int
ArchiveJobs(opts, args)
Archive jobs.
source code
int
AutoArchiveJobs(opts, args)
Archive jobs based on age.
source code
int
CancelJobs(opts, args)
Cancel not-yet-started jobs.
source code
int
ShowJobs(opts, args)
Show detailed information about jobs.
source code
int
WatchJob(opts, args)
Follow a job and print its output as it arrives.
source code
 
Main() source code
Variables [hide private]
  _LIST_DEF_FIELDS = ["id", "status", "summary"]
default list of fields for ListJobs
  _USER_JOB_STATUS = {constants.JOB_STATUS_QUEUED: "queued", con...
map converting the job status contants to user-visible names
  commands = {'list':(ListJobs, [ArgJobId()], [NOHDR_OPT, SEP_OP...

Imports: constants, errors, utils, cli


Function Details [hide private]

ListJobs(opts, args)

source code 

List the jobs

Parameters:
  • opts - the command line options selected by the user
  • args (list) - should be an empty list
Returns: int
the desired exit code

ArchiveJobs(opts, args)

source code 

Archive jobs.

Parameters:
  • opts - the command line options selected by the user
  • args (list) - should contain the job IDs to be archived
Returns: int
the desired exit code

AutoArchiveJobs(opts, args)

source code 

Archive jobs based on age.

This will archive jobs based on their age, or all jobs if a 'all' is passed.

Parameters:
  • opts - the command line options selected by the user
  • args (list) - should contain only one element, the age as a time spec that can be parsed by ganeti.cli.ParseTimespec or the keyword all, which will cause all jobs to be archived
Returns: int
the desired exit code

CancelJobs(opts, args)

source code 

Cancel not-yet-started jobs.

Parameters:
  • opts - the command line options selected by the user
  • args (list) - should contain the job IDs to be cancelled
Returns: int
the desired exit code

ShowJobs(opts, args)

source code 

Show detailed information about jobs.

Parameters:
  • opts - the command line options selected by the user
  • args (list) - should contain the job IDs to be queried
Returns: int
the desired exit code

WatchJob(opts, args)

source code 

Follow a job and print its output as it arrives.

Parameters:
  • opts - the command line options selected by the user
  • args (list) - Contains the job ID
Returns: int
the desired exit code

Variables Details [hide private]

_USER_JOB_STATUS

map converting the job status contants to user-visible names

Value:
{constants.JOB_STATUS_QUEUED: "queued", constants.JOB_STATUS_WAITLOCK:\
 "waiting", constants.JOB_STATUS_CANCELING: "canceling", constants.JOB\
_STATUS_RUNNING: "running", constants.JOB_STATUS_CANCELED: "canceled",\
 constants.JOB_STATUS_SUCCESS: "success", constants.JOB_STATUS_ERROR: \
"error",}

commands

Value:
{'list':(ListJobs, [ArgJobId()], [NOHDR_OPT, SEP_OPT, FIELDS_OPT], "[j\
ob_id ...]", "List the jobs and their status. The available fields are\
" " (see the man page for details): id, status, op_list," " op_status,\
 op_result." " The default field" " list is (in order): %s." % utils.C\
ommaJoin(_LIST_DEF_FIELDS)), 'archive':(ArchiveJobs, [ArgJobId(min= 1)\
], [], "<job-id> [<job-id> ...]", "Archive specified jobs"), 'autoarch\
ive':(AutoArchiveJobs, [ArgSuggest(min= 1, max= 1, choices= ["1d", "1w\
", "4w", "all"])], [], "<age>", "Auto archive jobs older than the give\
...