From patchwork Thu Jul 25 02:19:26 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Terceiro X-Patchwork-Id: 18556 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vb0-f72.google.com (mail-vb0-f72.google.com [209.85.212.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 439F625E75 for ; Thu, 25 Jul 2013 02:19:30 +0000 (UTC) Received: by mail-vb0-f72.google.com with SMTP id p12sf128595vbe.11 for ; Wed, 24 Jul 2013 19:19:29 -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=2enURe0C34NqFAUHhBtaN7/9/c0Lg/Er1GYzJLu1VFg=; b=MGiGNnKGKcwTRt1PL6UAg3rdDRmiDhHGZsfoJNyU95uDTcyuUapvhb73b50ePaKm6g kWvcZH/4hUWI9Mo+kbc0+9fMjoT8UYVRAYpJaqtsl4WLoq8JPzLuEYvGW6SEifGJkTch 9OP2QF1zhatc6FPaBtZhreEjdHiKCQ16A0fcEwHU6v4htwn+Bc78RgWhzeTQJDL4XeW5 6HCX486hYUcp1GCnyDihhdkCOo4ul8LhG0LoHsEIXfqknQPbMsv8YAL0MsnVoDbUYeaD KKbXApUCr5HSLrCcxNKhEpbMdRX7hQeOr7X7ZGMBvZXi4xJjZkabNjGzIw60sk/Yme5b EmdA== X-Received: by 10.58.187.2 with SMTP id fo2mr4811858vec.0.1374718769688; Wed, 24 Jul 2013 19:19:29 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.4.200 with SMTP id m8ls483521qem.70.gmail; Wed, 24 Jul 2013 19:19:29 -0700 (PDT) X-Received: by 10.58.199.133 with SMTP id jk5mr16549777vec.63.1374718769469; Wed, 24 Jul 2013 19:19:29 -0700 (PDT) Received: from mail-ve0-f177.google.com (mail-ve0-f177.google.com [209.85.128.177]) by mx.google.com with ESMTPS id im6si11404358vdb.150.2013.07.24.19.19.29 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 24 Jul 2013 19:19:29 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.177 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.177; Received: by mail-ve0-f177.google.com with SMTP id cz10so93899veb.22 for ; Wed, 24 Jul 2013 19:19:29 -0700 (PDT) X-Received: by 10.58.119.233 with SMTP id kx9mr16680069veb.3.1374718769262; Wed, 24 Jul 2013 19:19: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.58.165.8 with SMTP id yu8csp55893veb; Wed, 24 Jul 2013 19:19:28 -0700 (PDT) X-Received: by 10.180.74.8 with SMTP id p8mr313840wiv.32.1374718767346; Wed, 24 Jul 2013 19:19:27 -0700 (PDT) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id q4si17355409wjq.114.2013.07.24.19.19.27 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 24 Jul 2013 19:19:27 -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 1V2B9K-00037H-SJ for ; Thu, 25 Jul 2013 02:19:26 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id CCFE4E09EF for ; Thu, 25 Jul 2013 02:19:26 +0000 (UTC) MIME-Version: 1.0 X-Launchpad-Project: lava-dispatcher X-Launchpad-Branch: ~linaro-validation/lava-dispatcher/trunk X-Launchpad-Message-Rationale: Subscriber X-Launchpad-Branch-Revision-Number: 642 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-validation/lava-dispatcher/trunk] Rev 642: Make sure power_off() is always called at the end of a job Message-Id: <20130725021926.2458.40850.launchpad@ackee.canonical.com> Date: Thu, 25 Jul 2013 02:19:26 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: list X-Generated-By: Launchpad (canonical.com); Revision="16700"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: b0e5a35cc54751cb7746b93c9086e6bf0e25bd98 X-Gm-Message-State: ALoCoQlC2Bpud+De+uzfQ2NXBexoiKYjxPNlQ/BZi0adn/k0dmGjUnC1Ao5Pj3/g70xs3saj2Idg X-Original-Sender: noreply@launchpad.net X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.177 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: , ------------------------------------------------------------ revno: 642 committer: Antonio Terceiro branch nick: kill-fastmodel-process timestamp: Wed 2013-07-24 13:56:18 -0300 message: Make sure power_off() is always called at the end of a job This way all device objects can always clean up after themselves. Previously power_off was only called by TargetBasedClient#retrieve_results, i.e. the device's power_off() was only called when the job contained a submit_results action. modified: lava_dispatcher/client/base.py lava_dispatcher/client/targetdevice.py lava_dispatcher/context.py lava_dispatcher/job.py lava_dispatcher/utils.py --- lp:lava-dispatcher https://code.launchpad.net/~linaro-validation/lava-dispatcher/trunk You are subscribed to branch lp:lava-dispatcher. To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-dispatcher/trunk/+edit-subscription === modified file 'lava_dispatcher/client/base.py' --- lava_dispatcher/client/base.py 2013-07-16 16:02:15 +0000 +++ lava_dispatcher/client/base.py 2013-07-24 16:56:18 +0000 @@ -475,6 +475,9 @@ def retrieve_results(self, result_disk): raise NotImplementedError(self.retrieve_results) + def finish(self): + pass + # Android stuff def get_android_adb_interface(self): === modified file 'lava_dispatcher/client/targetdevice.py' --- lava_dispatcher/client/targetdevice.py 2013-07-16 16:01:28 +0000 +++ lava_dispatcher/client/targetdevice.py 2013-07-24 16:56:18 +0000 @@ -67,7 +67,7 @@ def _boot_linaro_image(self): if self.proc: logging.warning('device already powered on, powering off first') - self.target_device.power_off(self.proc) + self._power_off_device() self.proc = self.target_device.power_on() def _boot_linaro_android_image(self): @@ -85,9 +85,9 @@ return self.tester_session() def retrieve_results(self, result_disk): + self._power_off_device() + td = self.target_device - td.power_off(self.proc) - tar = os.path.join(td.scratch_dir, 'lava_results.tgz') result_dir = self.context.config.lava_result_dir with td.file_system(td.config.root_part, result_dir) as mnt: @@ -99,3 +99,18 @@ a = super(TargetBasedClient, self).get_test_data_attachments() a.extend(self.target_device.get_test_data_attachments()) return a + + def finish(self): + self._power_off_device() + + def _power_off_device(self): + """ + Powers the associated device off by calling its power_off() method. + + Can be called multiple times, but only the first will be effective, all + the others will be no-ops (unless the device is powered on again by + calling one of the _boot* methods). + """ + if self.proc: + self.target_device.power_off(self.proc) + self.proc = None === modified file 'lava_dispatcher/context.py' --- lava_dispatcher/context.py 2013-07-16 16:07:31 +0000 +++ lava_dispatcher/context.py 2013-07-24 16:56:18 +0000 @@ -148,3 +148,6 @@ logging.debug("Executing on host : '%r'" % command) return subprocess.check_output(command) + def finish(self): + self.client.finish() + === modified file 'lava_dispatcher/job.py' --- lava_dispatcher/job.py 2013-07-16 16:08:07 +0000 +++ lava_dispatcher/job.py 2013-07-24 16:56:18 +0000 @@ -268,6 +268,7 @@ except Exception as err: logging.error("Failed to submit the test result. Error = %s", err) raise + self.context.finish() def _set_logging_level(self): # set logging level is optional === modified file 'lava_dispatcher/utils.py' --- lava_dispatcher/utils.py 2013-07-24 14:04:25 +0000 +++ lava_dispatcher/utils.py 2013-07-24 16:56:18 +0000 @@ -272,7 +272,7 @@ time=datetime.datetime.utcnow().timetuple()) def finalize_process(proc): - print("*** finalize_process ***") if proc: + logging.debug("Finalizing child proccess with PID %d" % proc.pid) proc.kill(9) proc.close()