Revision 917b4e56 scripts/gnt-job
b/scripts/gnt-job | ||
---|---|---|
30 | 30 |
from ganeti import errors |
31 | 31 |
|
32 | 32 |
|
33 |
#: default list of fields for L{ListJobs} |
|
33 | 34 |
_LIST_DEF_FIELDS = ["id", "status", "summary"] |
34 | 35 |
|
36 |
#: map converting the job status contants to user-visible |
|
37 |
#: names |
|
35 | 38 |
_USER_JOB_STATUS = { |
36 | 39 |
constants.JOB_STATUS_QUEUED: "queued", |
37 | 40 |
constants.JOB_STATUS_WAITLOCK: "waiting", |
... | ... | |
45 | 48 |
def ListJobs(opts, args): |
46 | 49 |
"""List the jobs |
47 | 50 |
|
51 |
@param opts: the command line options selected by the user |
|
52 |
@type args: list |
|
53 |
@param args: should be an empty list |
|
54 |
@rtype: int |
|
55 |
@return: the desired exit code |
|
56 |
|
|
48 | 57 |
""" |
49 | 58 |
if opts.output is None: |
50 | 59 |
selected_fields = _LIST_DEF_FIELDS |
... | ... | |
105 | 114 |
|
106 | 115 |
|
107 | 116 |
def ArchiveJobs(opts, args): |
117 |
"""Archive jobs. |
|
118 |
|
|
119 |
@param opts: the command line options selected by the user |
|
120 |
@type args: list |
|
121 |
@param args: should contain the job IDs to be archived |
|
122 |
@rtype: int |
|
123 |
@return: the desired exit code |
|
124 |
|
|
125 |
""" |
|
108 | 126 |
client = GetClient() |
109 | 127 |
|
110 | 128 |
for job_id in args: |
... | ... | |
114 | 132 |
|
115 | 133 |
|
116 | 134 |
def AutoArchiveJobs(opts, args): |
135 |
"""Archive jobs based on age. |
|
136 |
|
|
137 |
This will archive jobs based on their age, or all jobs if a 'all' is |
|
138 |
passed. |
|
139 |
|
|
140 |
@param opts: the command line options selected by the user |
|
141 |
@type args: list |
|
142 |
@param args: should contain only one element, the age as a time spec |
|
143 |
that can be parsed by L{cli.ParseTimespec} or the keyword I{all}, |
|
144 |
which will cause all jobs to be archived |
|
145 |
@rtype: int |
|
146 |
@return: the desired exit code |
|
147 |
|
|
148 |
""" |
|
117 | 149 |
client = GetClient() |
118 | 150 |
|
119 | 151 |
age = args[0] |
... | ... | |
128 | 160 |
|
129 | 161 |
|
130 | 162 |
def CancelJobs(opts, args): |
163 |
"""Cancel not-yet-started jobs. |
|
164 |
|
|
165 |
@param opts: the command line options selected by the user |
|
166 |
@type args: list |
|
167 |
@param args: should contain the job IDs to be cancelled |
|
168 |
@rtype: int |
|
169 |
@return: the desired exit code |
|
170 |
|
|
171 |
""" |
|
131 | 172 |
client = GetClient() |
132 | 173 |
|
133 | 174 |
for job_id in args: |
... | ... | |
137 | 178 |
|
138 | 179 |
|
139 | 180 |
def ShowJobs(opts, args): |
140 |
"""List the jobs |
|
181 |
"""Show detailed information about jobs. |
|
182 |
|
|
183 |
@param opts: the command line options selected by the user |
|
184 |
@type args: list |
|
185 |
@param args: should contain the job IDs to be queried |
|
186 |
@rtype: int |
|
187 |
@return: the desired exit code |
|
141 | 188 |
|
142 | 189 |
""" |
143 | 190 |
def format(level, text): |
Also available in: Unified diff