From patchwork Tue Sep 17 21:23:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fu Wei Fu X-Patchwork-Id: 20380 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f197.google.com (mail-ve0-f197.google.com [209.85.128.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id CC3C1203C2 for ; Tue, 17 Sep 2013 21:23:29 +0000 (UTC) Received: by mail-ve0-f197.google.com with SMTP id jy13sf6432024veb.8 for ; Tue, 17 Sep 2013 14:23:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:mime-version:to:from:subject :message-id:date:reply-to:sender:errors-to:precedence :x-original-sender:x-original-authentication-results:mailing-list :list-id:list-post:list-help:list-archive:list-unsubscribe :content-type; bh=Vo204tkZTW81ExLjr080M2gWjS/1EXcNSxmrAHet7ug=; b=GQ4GARuvZHwBzYNpnztTqvVle6dJ3xygNVFrfZURyw+opjiFSl2Y7l/Nkpcwga4XXr 353Gqz5cXC2yJ08uvYvtkkbijvFY39c5k3FtbOYTfpNABJ3waxrrM3vAXfrL6orXXvPM m6Z1nbT+nI6kiVxn1gCY8Ges1MmrAQrIulmhXPUUbxOgebaG4PO90HCoePvdu6vaqjh4 qOVO+Afw+B5DVfb1e3a4CcD8k1Ggeku6BlX8s0y1tRLwNkSO8y+hcPyA2gZaBhF6NFKT y2pNwCJQlJho8FewzgXcLsjGqG5gT6ees/+O8DleVPiCWjwlfWNG4wBO4B4Q3rHIfQlg vpRg== X-Gm-Message-State: ALoCoQk12R+kqEqnFmIZhQa+md9X8mGHqL6MshqQM6K+xFDICxE4sJwBT+LvQurAWBIZPx7JOssD X-Received: by 10.236.145.34 with SMTP id o22mr13654323yhj.22.1379453009393; Tue, 17 Sep 2013 14:23:29 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.70.228 with SMTP id p4ls2959059qeu.43.gmail; Tue, 17 Sep 2013 14:23:29 -0700 (PDT) X-Received: by 10.58.118.130 with SMTP id km2mr33936053veb.0.1379453009304; Tue, 17 Sep 2013 14:23:29 -0700 (PDT) Received: from mail-vb0-f50.google.com (mail-vb0-f50.google.com [209.85.212.50]) by mx.google.com with ESMTPS id dj3si9308659vcb.119.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 17 Sep 2013 14:23:29 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.50 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.50; Received: by mail-vb0-f50.google.com with SMTP id x14so4489406vbb.37 for ; Tue, 17 Sep 2013 14:23:29 -0700 (PDT) X-Received: by 10.220.173.134 with SMTP id p6mr54789vcz.36.1379453009214; Tue, 17 Sep 2013 14:23:29 -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.174.196 with SMTP id u4csp182055vcz; Tue, 17 Sep 2013 14:23:28 -0700 (PDT) X-Received: by 10.180.185.77 with SMTP id fa13mr4121874wic.58.1379453005467; Tue, 17 Sep 2013 14:23:25 -0700 (PDT) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id r4si2500879wij.39.1969.12.31.16.00.00 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 17 Sep 2013 14:23:25 -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 1VM2k0-0001Rn-Vt for ; Tue, 17 Sep 2013 21:23:24 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id E3B24F6747 for ; Tue, 17 Sep 2013 21:23:24 +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: 263 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-validation/lava-scheduler/trunk] Rev 263: update to latest version of trunk Message-Id: <20130917212324.28197.14844.launchpad@ackee.canonical.com> Date: Tue, 17 Sep 2013 21:23:24 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: list X-Generated-By: Launchpad (canonical.com); Revision="16765"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: 2cea6c5b57fb53b1ea89575b8efb46a41748496c X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: noreply@launchpad.net X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.50 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: Neil Williams (codehelp) Senthil Kumaran S (stylesen) Related merge proposals: https://code.launchpad.net/~codehelp/lava-scheduler/1223264/+merge/185473 proposed by: Neil Williams (codehelp) review: Approve - Matthew Hart (matthew-hart) https://code.launchpad.net/~codehelp/lava-scheduler/group-size-limit/+merge/185217 proposed by: Neil Williams (codehelp) review: Approve - Senthil Kumaran S (stylesen) https://code.launchpad.net/~stylesen/lava-scheduler/fix-bug-1224260/+merge/185211 proposed by: Senthil Kumaran S (stylesen) review: Approve - Neil Williams (codehelp) https://code.launchpad.net/~stylesen/lava-scheduler/fix-bug-1224261/+merge/185207 proposed by: Senthil Kumaran S (stylesen) review: Approve - Neil Williams (codehelp) ------------------------------------------------------------ revno: 263 [merge] committer: Fu Wei branch nick: lmp timestamp: Tue 2013-09-17 22:59:18 +0800 message: update to latest version of trunk modified: lava_scheduler_app/api.py lava_scheduler_app/models.py lava_scheduler_app/utils.py lava_scheduler_app/views.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-09-02 15:14:15 +0000 +++ lava_scheduler_app/api.py 2013-09-13 11:39:18 +0000 @@ -200,10 +200,15 @@ pending_jobs_by_device = {} - jobs = TestJob.objects.filter(status=TestJob.SUBMITTED)\ + jobs_res = TestJob.objects.filter(status=TestJob.SUBMITTED)\ .values_list('requested_device_type_id')\ .annotate(pending_jobs=(Count('id'))) - pending_jobs_by_device.update(dict(jobs)) + jobs = {} + jobs_hash = dict(jobs_res) + for job in jobs_hash: + if job: + jobs[job] = jobs_hash[job] + pending_jobs_by_device.update(jobs) # Get rest of the devices and put number of pending jobs as 0. device_types = DeviceType.objects.values_list('name', flat=True) === modified file 'lava_scheduler_app/models.py' --- lava_scheduler_app/models.py 2013-09-04 14:46:59 +0000 +++ lava_scheduler_app/models.py 2013-09-12 06:28:07 +0000 @@ -81,7 +81,7 @@ continue else: raise DevicesUnavailableException( - "Requested %d %s device(s) - only %d available." % (count, board, all_devices[board])) + "Requested %d %s device(s) - only %d available." % (count, board, all_devices.get(board,0))) return True === modified file 'lava_scheduler_app/utils.py' --- lava_scheduler_app/utils.py 2013-09-10 13:20:02 +0000 +++ lava_scheduler_app/utils.py 2013-09-17 14:59:18 +0000 @@ -22,6 +22,7 @@ import socket import urlparse import simplejson +import models def rewrite_hostname(result_url): @@ -89,6 +90,8 @@ group_count = 0 for clients in json_jobdata["device_group"]: group_count += int(clients["count"]) + if group_count <= 1: + raise models.JSONDataError("Only one device requested in a MultiNode job submission.") for clients in json_jobdata["device_group"]: role = str(clients["role"]) count = int(clients["count"]) @@ -96,8 +99,10 @@ for c in range(0, count): node_json[role].append({}) node_json[role][c]["timeout"] = json_jobdata["timeout"] - node_json[role][c]["job_name"] = json_jobdata["job_name"] - node_json[role][c]["tags"] = clients["tags"] + if json_jobdata.get("job_name", False): + node_json[role][c]["job_name"] = json_jobdata["job_name"] + if clients.get("tags", False): + node_json[role][c]["tags"] = clients["tags"] node_json[role][c]["group_size"] = group_count node_json[role][c]["target_group"] = target_group node_json[role][c]["actions"] = node_actions[role] @@ -105,7 +110,11 @@ node_json[role][c]["role"] = role # multinode node stage 2 - node_json[role][c]["logging_level"] = json_jobdata["logging_level"] + if json_jobdata.get("logging_level", False): + node_json[role][c]["logging_level"] = \ + json_jobdata["logging_level"] + if json_jobdata.get("priority", False): + node_json[role][c]["priority"] = json_jobdata["priority"] node_json[role][c]["device_type"] = clients["device_type"] return node_json === modified file 'lava_scheduler_app/views.py' --- lava_scheduler_app/views.py 2013-09-02 15:14:15 +0000 +++ lava_scheduler_app/views.py 2013-09-12 06:28:07 +0000 @@ -53,6 +53,7 @@ TestJob, JSONDataError, validate_job_json, + DevicesUnavailableException, ) @@ -606,7 +607,8 @@ "lava_scheduler_app/job_submit.html", response_data, RequestContext(request)) - except (JSONDataError, ValueError) as e: + except (JSONDataError, ValueError, DevicesUnavailableException) \ + as e: response_data["error"] = str(e) response_data["json_input"] = request.POST.get("json-input") return render_to_response( @@ -842,7 +844,7 @@ response_data, RequestContext(request)) else: return redirect(job) - except Exception as e: + except (JSONDataError, ValueError, DevicesUnavailableException) as e: response_data["error"] = str(e) response_data["json_input"] = definition return render_to_response(