Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
synnefo
Commits
84f165f4
Commit
84f165f4
authored
Jul 24, 2013
by
Christos Stavrakakis
Browse files
cyclades-rapi: Add bulk option to GetJobs
parent
b35254cf
Changes
2
Hide whitespace changes
Inline
Side-by-side
snf-cyclades-app/synnefo/logic/backend.py
View file @
84f165f4
...
...
@@ -798,9 +798,9 @@ def get_nodes(backend, bulk=True):
return
c
.
GetNodes
(
bulk
=
bulk
)
def
get_jobs
(
backend
):
def
get_jobs
(
backend
,
bulk
=
True
):
with
pooled_rapi_client
(
backend
)
as
c
:
return
c
.
GetJobs
()
return
c
.
GetJobs
(
bulk
=
bulk
)
def
get_physical_resources
(
backend
):
...
...
snf-cyclades-app/synnefo/logic/rapi.py
View file @
84f165f4
...
...
@@ -1173,17 +1173,23 @@ class GanetiRapiClient(object): # pylint: disable=R0904
(
"/%s/instances/%s/console"
%
(
GANETI_RAPI_VERSION
,
instance
)),
None
,
None
)
def
GetJobs
(
self
):
def
GetJobs
(
self
,
bulk
=
False
):
"""Gets all jobs for the cluster.
@rtype: list of int
@return: job ids for the cluster
"""
return
[
int
(
j
[
"id"
])
for
j
in
self
.
_SendRequest
(
HTTP_GET
,
"/%s/jobs"
%
GANETI_RAPI_VERSION
,
None
,
None
)]
query
=
[]
_AppendIf
(
query
,
bulk
,
(
"bulk"
,
1
))
jobs
=
self
.
_SendRequest
(
HTTP_GET
,
"/%s/jobs"
%
GANETI_RAPI_VERSION
,
query
,
None
)
if
bulk
:
return
jobs
else
:
return
[
int
(
j
[
"id"
])
for
j
in
jobs
]
def
GetJobStatus
(
self
,
job_id
):
"""Gets the status of a job.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment