Commit 84f165f4 authored by Christos Stavrakakis's avatar Christos Stavrakakis
Browse files

cyclades-rapi: Add bulk option to GetJobs

parent b35254cf
......@@ -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):
......@@ -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,
None, None)]
query = []
_AppendIf(query, bulk, ("bulk", 1))
jobs = self._SendRequest(HTTP_GET, "/%s/jobs" % GANETI_RAPI_VERSION,
query, None)
if bulk:
return jobs
return [int(j["id"]) for j in jobs]
def GetJobStatus(self, job_id):
"""Gets the status of a job.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment