From patchwork Mon Aug 27 14:31:10 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael-Doyle Hudson X-Patchwork-Id: 10979 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id E47A323E56 for ; Mon, 27 Aug 2012 14:31:15 +0000 (UTC) Received: from mail-iy0-f180.google.com (mail-iy0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id E5704A18208 for ; Mon, 27 Aug 2012 14:30:48 +0000 (UTC) Received: by iafj25 with SMTP id j25so5680262iaf.11 for ; Mon, 27 Aug 2012 07:31:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf :content-type: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; bh=LOGx/VmOummmhqgGvouUZAlX4c80MqsYqdmDs5UlZkw=; b=I4ze3LfDI3yEa1ZxZbx9o05LVjCVdplsalsGPn5g5iYgHqctihAkWT4VY7Qtl8QuAg XT1sK2/VdALbWRNGQ5do4wSpmeqypkte4WH4tsEJXFpvvtt74EvVTUHCLsfWiZYJgesY lg3UWzSInQ5ku2p7ErLiyyY0/DySAl3rHH5Tzv4hooIuW41m4YTOoQf4J0oJlAuNCQbc cC7hrPqXD1/dk+8tLQee5UgYbj+cuGHUW+mzc0/g1upJOONXzkNgjIkqxN0oqXNUxGUi zM7JIV6cZLTQ9N65B/YdipxbrgNcyFhJE2NqpIFOGS1ROv4hVNyLm1VDsC7zr8uwRGEw i+mw== Received: by 10.50.180.129 with SMTP id do1mr10427565igc.28.1346077874808; Mon, 27 Aug 2012 07:31:14 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.184.232 with SMTP id ex8csp443963igc; Mon, 27 Aug 2012 07:31:13 -0700 (PDT) Received: by 10.180.93.68 with SMTP id cs4mr25989149wib.14.1346077871743; Mon, 27 Aug 2012 07:31:11 -0700 (PDT) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id e5si16397019wiz.14.2012.08.27.07.31.11 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 27 Aug 2012 07:31:11 -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; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) smtp.mail=bounces@canonical.com Received: from ackee.canonical.com ([91.189.89.26]) by indium.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1T60LO-0002iu-TZ for ; Mon, 27 Aug 2012 14:31:10 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id CA410E01D2 for ; Mon, 27 Aug 2012 14:31:10 +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: 205 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-validation/lava-scheduler/trunk] Rev 205: hack to get missing log files to mean that job files can still display Message-Id: <20120827143110.6060.80127.launchpad@ackee.canonical.com> Date: Mon, 27 Aug 2012 14:31:10 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="15843"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: 9a091a6de5484cc001356804f07e2f01caf5deef X-Gm-Message-State: ALoCoQnPN4UzUcAatLahT9oA6PKWnE1YyENTh5wQz+vRMd9fNqLnOstA02cP9Ta16+PeY3D8vi2u ------------------------------------------------------------ revno: 205 committer: Michael Hudson-Doyle branch nick: missing-log-file-bug-1035307 timestamp: Mon 2012-08-27 11:52:54 +1200 message: hack to get missing log files to mean that job files can still display modified: 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/views.py' --- lava_scheduler_app/views.py 2012-08-03 16:12:09 +0000 +++ lava_scheduler_app/views.py 2012-08-26 23:52:54 +0000 @@ -489,9 +489,15 @@ 'show_reload_page' : job.status <= TestJob.RUNNING, } - if job.log_file: - job_errors = getDispatcherErrors(job.log_file) - job_log_messages = getDispatcherLogMessages(job.log_file) + log_file = job.log_file + try: + log_file.open() + except IOError: + log_file = None + + if log_file: + job_errors = getDispatcherErrors(log_file) + job_log_messages = getDispatcherLogMessages(log_file) levels = defaultdict(int) for kl in ['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL']: @@ -505,7 +511,7 @@ 'job_has_error' : len(job_errors) > 0, 'job_log_messages' : job_log_messages, 'levels': levels, - 'job_file_size' : job.log_file.size, + 'job_file_size' : log_file.size, }) else: data.update({ @@ -518,11 +524,16 @@ def job_definition(request, pk): job = get_restricted_job(request.user, pk) + log_file = job.log_file + try: + log_file.open() + except IOError: + log_file = None return render_to_response( "lava_scheduler_app/job_definition.html", { 'job': job, - 'job_file_present': bool(job.log_file), + 'job_file_present': bool(log_file), }, RequestContext(request))