From patchwork Sat Jul 6 09:45:21 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Baker X-Patchwork-Id: 18273 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-gh0-f198.google.com (mail-gh0-f198.google.com [209.85.160.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C076825E04 for ; Sat, 6 Jul 2013 09:45:24 +0000 (UTC) Received: by mail-gh0-f198.google.com with SMTP id r13sf3366007ghr.5 for ; Sat, 06 Jul 2013 02:45:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-beenthere:x-forwarded-to:x-forwarded-for:delivered-to :mime-version:x-launchpad-project:x-launchpad-branch :x-launchpad-message-rationale:x-launchpad-branch-revision-number :x-launchpad-notification-type:to:from:subject:message-id:date :reply-to:sender:errors-to:precedence:x-generated-by :x-launchpad-hash:x-gm-message-state:x-original-sender :x-original-authentication-results:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe :content-type; bh=vQSodgoTpMvHPMxSVTTZyMyJp+/RhbqbkH+YSd1R0dY=; b=VAnebJZ4G+UXBFszHbhKbe6xJKhXEfD2uzHdpFVka8idpEy6OuqJ7eDoqHp1I2i9g4 cvb0RCQIV5OKAJ/BQLeMDc9NI4UZcGQUElwHORkOX4lFQJ0ISfhaJa8LaMcuYseaKJb7 O8BIiT38k6bTX03dnc97P72AIiKPu/ySgT4HpvvUmlYSOhOF3cN288xrOeGXFc77yJQo lj7XLQa0ny4BHXybaTTlQ5nNc6utxjxhWQHe0+jFi4j6pQ4S58CZHoHOHJuIFnThezC8 0mo/4sXNP/jkAg0qX+313cHVLLvuKAndGdd0nJ5nD08H5A9F5F5rQk070ncDQOWRLl4Y qt8Q== X-Received: by 10.224.29.76 with SMTP id p12mr16404750qac.5.1373103923820; Sat, 06 Jul 2013 02:45:23 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.106.134 with SMTP id gu6ls1263298qeb.83.gmail; Sat, 06 Jul 2013 02:45:23 -0700 (PDT) X-Received: by 10.220.20.3 with SMTP id d3mr9733838vcb.55.1373103923584; Sat, 06 Jul 2013 02:45:23 -0700 (PDT) Received: from mail-vb0-f47.google.com (mail-vb0-f47.google.com [209.85.212.47]) by mx.google.com with ESMTPS id f8si3540878vec.47.2013.07.06.02.45.23 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 06 Jul 2013 02:45:23 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.47 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.47; Received: by mail-vb0-f47.google.com with SMTP id x14so2278645vbb.34 for ; Sat, 06 Jul 2013 02:45:23 -0700 (PDT) X-Received: by 10.220.70.76 with SMTP id c12mr9605508vcj.8.1373103923476; Sat, 06 Jul 2013 02:45:23 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.149.77 with SMTP id s13csp90645vcv; Sat, 6 Jul 2013 02:45:22 -0700 (PDT) X-Received: by 10.14.8.197 with SMTP id 45mr15969811eer.66.1373103921989; Sat, 06 Jul 2013 02:45:21 -0700 (PDT) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id o41si9252539eep.349.2013.07.06.02.45.21 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Sat, 06 Jul 2013 02:45:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) client-ip=91.189.90.7; Received: from ackee.canonical.com ([91.189.89.26]) by indium.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1UvP3R-0002SJ-8W for ; Sat, 06 Jul 2013 09:45:21 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id 32125E0421 for ; Sat, 6 Jul 2013 09:45:21 +0000 (UTC) MIME-Version: 1.0 X-Launchpad-Project: lava-scheduler X-Launchpad-Branch: ~linaro-validation/lava-scheduler/trunk X-Launchpad-Message-Rationale: Subscriber X-Launchpad-Branch-Revision-Number: 250 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-validation/lava-scheduler/trunk] Rev 250: Add job status Message-Id: <20130706094521.32153.79590.launchpad@ackee.canonical.com> Date: Sat, 06 Jul 2013 09:45:21 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: list X-Generated-By: Launchpad (canonical.com); Revision="16696"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: 45b5f0569217b6b796241d037d40bf734824a419 X-Gm-Message-State: ALoCoQl/8q29RZoXEq19fGUr48EsWeAvVlAj6NQNrVOXpx/OJMsOpnCvHImr5TPGtW75HwdaB7Mr X-Original-Sender: noreply@launchpad.net X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.47 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Merge authors: Arthur She (arthur-she) Related merge proposals: https://code.launchpad.net/~arthur-she/lava-scheduler/add-job_status/+merge/172775 proposed by: Arthur She (arthur-she) review: Approve - Senthil Kumaran S (stylesen) ------------------------------------------------------------ revno: 250 [merge] committer: Tyler Baker branch nick: lava-scheduler timestamp: Sat 2013-07-06 10:44:05 +0100 message: Add job status 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 === modified file 'lava_scheduler_app/api.py' --- lava_scheduler_app/api.py 2013-05-02 07:35:44 +0000 +++ lava_scheduler_app/api.py 2013-07-03 09:30:33 +0000 @@ -232,3 +232,56 @@ raise xmlrpclib.Fault(404, "Specified job not found.") return job + + def job_status(self, job_id): + """ + Name + ---- + `job_status` (`job_id`) + + Description + ----------- + Get the status 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 status with the follwing fields. + The user is authenticated with an username and token. + + `job_status`: string + ['Submitted'|'Running'|'Complete'|'Incomplete'|'Canceled'|'Canceling'] + + `bundle_sha1`: string + The sha1 hash code of the bundle, if it existed. Otherwise it will be an empty string. + """ + + 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.") + + + bundle_sha1 = "" + try: + bundle_sha1 = job.results_link.split('/')[-2] + except: + pass + + job_status = { + 'job_status': job.get_status_display(), + 'bundle_sha1': bundle_sha1 + } + + return job_status +