Script gnt_job
[hide private]
[frames] | no frames]

Script gnt_job

Job related commands

Functions [hide private]
int
ListJobs(opts, args)
List the jobs
int
ArchiveJobs(opts, args)
Archive jobs.
int
AutoArchiveJobs(opts, args)
Archive jobs based on age.
int
CancelJobs(opts, args)
Cancel not-yet-started jobs.
int
ShowJobs(opts, args)
Show detailed information about jobs.
int
WatchJob(opts, args)
Follow a job and print its output as it arrives.
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: sys, constants, errors, utils, cli


Function Details [hide private]

ListJobs(opts, args)

 

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)

 

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)

 

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)

 

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)

 

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)

 

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\
...