diff mbox

[Branch,~linaro-validation/lava-scheduler/trunk] Rev 245: Fix bug #1110713 - Please add XMLRPC call for "get job result bundle".

Message ID 20130502090215.2749.97980.launchpad@ackee.canonical.com
State Accepted
Headers show

Commit Message

Senthil Kumaran May 2, 2013, 9:02 a.m. UTC
------------------------------------------------------------
revno: 245
committer: Senthil Kumaran <senthil.kumaran@linaro.org>
branch nick: trunk
timestamp: Thu 2013-05-02 13:05:44 +0530
message:
  Fix bug #1110713 - Please add XMLRPC call for "get job result bundle".
modified:
  lava_scheduler_app/api.py


--
lp:lava-scheduler
https://code.launchpad.net/~linaro-validation/lava-scheduler/trunk

You are subscribed to branch lp:lava-scheduler.
To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-scheduler/trunk/+edit-subscription
diff mbox

Patch

=== modified file 'lava_scheduler_app/api.py'
--- lava_scheduler_app/api.py	2013-04-18 00:58:20 +0000
+++ lava_scheduler_app/api.py	2013-05-02 07:35:44 +0000
@@ -198,3 +198,37 @@ 
                 pending_jobs_by_device[device_type] = 0
                 
         return pending_jobs_by_device
+
+    def job_details(self, job_id):
+        """
+        Name
+        ----
+        `job_details` (`job_id`)
+
+        Description
+        -----------
+        Get the details of given job id.
+
+        Arguments
+        ---------
+        `job_id`: string
+            Job id for which the output is required.
+
+        Return value
+        ------------
+        This function returns an XML-RPC structures of job details, provided
+        the user is authenticated with an username and token.
+        """
+
+        if not self.user:
+            raise xmlrpclib.Fault(
+                401, "Authentication with user and token required for this "
+                "API.")
+
+        try:
+            job = TestJob.objects.accessible_by_principal(self.user).get(
+                pk=job_id)
+        except TestJob.DoesNotExist:
+            raise xmlrpclib.Fault(404, "Specified job not found.")
+
+        return job