Merge lp:~stylesen/lava-scheduler/multinode into lp:lava-scheduler/multinode

Proposed by Senthil Kumaran S
Status: Merged
Approved by: Neil Williams
Approved revision: no longer in the source branch.
Merged at revision: 266
Proposed branch: lp:~stylesen/lava-scheduler/multinode
Merge into: lp:lava-scheduler/multinode
Diff against target: 75 lines (+53/-4)
2 files modified
lava_scheduler_app/api.py (+53/-0)
lava_scheduler_app/models.py (+0/-4)
To merge this branch: bzr merge lp:~stylesen/lava-scheduler/multinode
Reviewer Review Type Date Requested Status
Neil Williams Approve
Review via email: mp+176321@code.launchpad.net

Description of the change

Bring up-to-date with trunk.

To post a comment you must log in.
Revision history for this message
Neil Williams (codehelp) wrote :

Approved.

review: Approve
266. By Neil Williams

Senthil Kumaran 2013-07-23 [merge] Bring up-to-date with trunk.
  Senthil Kumaran 2013-07-22 Remove commented out code in models.py since we are already version
  Tyler Baker 2013-07-06 [merge] Add job status
  Arthur She 2013-07-03 Fix some typos and complete the description of job_status() API.
  Arthur She 2013-07-03 Add API job_status() for polling job status.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lava_scheduler_app/api.py'
2--- lava_scheduler_app/api.py 2013-07-22 09:26:30 +0000
3+++ lava_scheduler_app/api.py 2013-07-23 04:52:26 +0000
4@@ -239,3 +239,56 @@
5 raise xmlrpclib.Fault(404, "Specified job not found.")
6
7 return job
8+
9+ def job_status(self, job_id):
10+ """
11+ Name
12+ ----
13+ `job_status` (`job_id`)
14+
15+ Description
16+ -----------
17+ Get the status of given job id.
18+
19+ Arguments
20+ ---------
21+ `job_id`: string
22+ Job id for which the output is required.
23+
24+ Return value
25+ ------------
26+ This function returns an XML-RPC structures of job status with the follwing fields.
27+ The user is authenticated with an username and token.
28+
29+ `job_status`: string
30+ ['Submitted'|'Running'|'Complete'|'Incomplete'|'Canceled'|'Canceling']
31+
32+ `bundle_sha1`: string
33+ The sha1 hash code of the bundle, if it existed. Otherwise it will be an empty string.
34+ """
35+
36+ if not self.user:
37+ raise xmlrpclib.Fault(
38+ 401, "Authentication with user and token required for this "
39+ "API.")
40+
41+ try:
42+ job = TestJob.objects.accessible_by_principal(self.user).get(
43+ pk=job_id)
44+ except TestJob.DoesNotExist:
45+ raise xmlrpclib.Fault(404, "Specified job not found.")
46+
47+
48+ bundle_sha1 = ""
49+ try:
50+ bundle_sha1 = job.results_link.split('/')[-2]
51+ except:
52+ pass
53+
54+ job_status = {
55+ 'job_status': job.get_status_display(),
56+ 'bundle_sha1': bundle_sha1
57+ }
58+
59+ return job_status
60+
61
62=== modified file 'lava_scheduler_app/models.py'
63--- lava_scheduler_app/models.py 2013-07-22 09:34:35 +0000
64+++ lava_scheduler_app/models.py 2013-07-23 04:52:26 +0000
65@@ -237,10 +237,6 @@
66 self.health_status = Device.HEALTH_LOOPING
67 self.save()
68
69- #@classmethod
70- #def find_devices_by_type(cls, device_type):
71- # return device_type.device_set.all()
72-
73
74 class JobFailureTag(models.Model):
75 """

Subscribers

People subscribed via source and target branches

to status/vote changes: