module documentation

Job related commands

Function ArchiveJobs Archive jobs.
Function AutoArchiveJobs Archive jobs based on age.
Function CancelJobs Cancel not-yet-started jobs.
Function ChangePriority Change priority of jobs.
Function ListJobFields List job fields.
Function ListJobs List the jobs
Function Main Undocumented
Function ShowJobs Show detailed information about jobs.
Function WaitJob Wait for a job to finish, not producing any output.
Function WatchJob Follow a job and print its output as it arrives.
Variable aliases Undocumented
Variable commands Undocumented
Function _CalcDelta Calculates the delta between two timestamps.
Function _FormatStatus Formats a job status.
Function _FormatSummary Formats a job's summary.
Function _ListJobTimestamp Adds the job timestamp to the given container.
Function _ListOpcodeTimestamp Adds the opcode timestamp to the given container.
Function _MultiJobAction Applies a function to multiple jobs.
Function _ParseJobIds Parses a list of string job IDs into integers.
Constant _ARCHIVED_OPT Undocumented
Constant _ERROR_OPT Undocumented
Constant _FINISHED_OPT Undocumented
Constant _JOB_LIST_FORMAT Undocumented
Constant _KILL_OPT Undocumented
Constant _LIST_DEF_FIELDS Undocumented
Constant _PENDING_OPT Undocumented
Constant _QUEUED_OPT Undocumented
Constant _RUNNING_OPT Undocumented
Constant _USER_JOB_STATUS Undocumented
Constant _WAITING_OPT Undocumented
Constant _YES_DOIT_OPT Undocumented
def ArchiveJobs(opts, args):

Archive jobs.

Parameters
optsthe command line options selected by the user
args:listshould contain the job IDs to be archived
Returns
intthe desired exit code
def 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
optsthe command line options selected by the user
args:listshould 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
intthe desired exit code
def CancelJobs(opts, args, cl=None, _stdout_fn=ToStdout, _ask_fn=AskUser):

Cancel not-yet-started jobs.

Parameters
optsthe command line options selected by the user
args:listshould contain the job IDs to be cancelled
clUndocumented
_stdout_fnUndocumented
_ask_fnUndocumented
Returns
intthe desired exit code
def ChangePriority(opts, args):

Change priority of jobs.

Parameters
optsCommand line options
args:listJob IDs
Returns
intExit code
def ListJobFields(opts, args):

List job fields.

Parameters
optsthe command line options selected by the user
args:listfields to list, or empty for all
Returns
intthe desired exit code
def ListJobs(opts, args):

List the jobs

Parameters
optsthe command line options selected by the user
args:listshould be an empty list
Returns
intthe desired exit code
def Main():

Undocumented

def ShowJobs(opts, args):

Show detailed information about jobs.

Parameters
optsthe command line options selected by the user
args:listshould contain the job IDs to be queried
Returns
intthe desired exit code
def WaitJob(opts, args):

Wait for a job to finish, not producing any output.

Parameters
optsthe command line options selected by the user
args:listContains the job ID
Returns
intthe desired exit code
def WatchJob(opts, args):

Follow a job and print its output as it arrives.

Parameters
optsthe command line options selected by the user
args:listContains the job ID
Returns
intthe desired exit code
aliases: dict[str, str] =

Undocumented

commands =

Undocumented

def _CalcDelta(from_ts, to_ts):

Calculates the delta between two timestamps.

def _FormatStatus(value):

Formats a job status.

def _FormatSummary(value):

Formats a job's summary.

def _ListJobTimestamp(name, ts, container, prior_ts=None):

Adds the job timestamp to the given container.

Parameters
nameUndocumented
tsUndocumented
containerUndocumented
prior_tsThe timestamp used to calculate the amount of time that passed since the given timestamp.
def _ListOpcodeTimestamp(name, ts, container):

Adds the opcode timestamp to the given container.

def _MultiJobAction(opts, args, cl, stdout_fn, ask_fn, question, action_fn):

Applies a function to multiple jobs.

Parameters
optsCommand line options
args:listJob IDs
clUndocumented
stdout_fnUndocumented
ask_fnUndocumented
questionUndocumented
action_fnUndocumented
Returns
intExit code
def _ParseJobIds(args):

Parses a list of string job IDs into integers.

Parameters
argslist of strings
Returns
list of integers
Raises
OpPrereqErrorin case of invalid values
_ARCHIVED_OPT =

Undocumented

Value
cli_option('--archived',
           default=False,
           action='store_true',
           dest='archived',
           help='Include archived jobs in list (slow and expensive)')
_ERROR_OPT =

Undocumented

Value
cli_option('--error',
           default=None,
           action='store_const',
           dest='status_filter',
           const=frozenset([constants.JOB_STATUS_ERROR]),
           help='Show failed jobs only')
_FINISHED_OPT =

Undocumented

Value
cli_option('--finished',
           default=None,
           action='store_const',
           dest='status_filter',
           const=constants.JOBS_FINALIZED,
           help='Show finished jobs only')
_JOB_LIST_FORMAT =

Undocumented

Value
{'status': (_FormatStatus, False), 'summary': (_FormatSummary, False)}
_KILL_OPT =

Undocumented

Value
cli_option('--kill',
           default=False,
           action='store_true',
           dest='kill',
           help='Kill running jobs with SIGKILL')
_LIST_DEF_FIELDS: list[str] =

Undocumented

Value
['id', 'status', 'summary']
_PENDING_OPT =

Undocumented

Value
cli_option('--pending',
           default=None,
           action='store_const',
           dest='status_filter',
           const=constants.JOBS_PENDING,
           help='Select jobs pending execution or being cancelled')
_QUEUED_OPT =

Undocumented

Value
cli_option('--queued',
           default=None,
           action='store_const',
           dest='status_filter',
           const=frozenset([constants.JOB_STATUS_QUEUED]),
           help='Select queued jobs only')
_RUNNING_OPT =

Undocumented

Value
cli_option('--running',
           default=None,
           action='store_const',
           dest='status_filter',
           const=frozenset([constants.JOB_STATUS_RUNNING]),
           help='Show jobs currently running only')
_WAITING_OPT =

Undocumented

Value
cli_option('--waiting',
           default=None,
           action='store_const',
           dest='status_filter',
           const=frozenset([constants.JOB_STATUS_WAITING]),
           help='Select waiting jobs only')
_YES_DOIT_OPT =

Undocumented

Value
cli_option('--yes-do-it', '--ya-rly',
           dest='yes_do_it', help='Really use --kill', action='store_true')