From patchwork Thu Jun 14 06:02:11 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: 9277 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 0F11223E55 for ; Thu, 14 Jun 2012 06:02:14 +0000 (UTC) Received: from mail-gg0-f180.google.com (mail-gg0-f180.google.com [209.85.161.180]) by fiordland.canonical.com (Postfix) with ESMTP id AE759A183BD for ; Thu, 14 Jun 2012 06:02:13 +0000 (UTC) Received: by ggnf1 with SMTP id f1so1180926ggn.11 for ; Wed, 13 Jun 2012 23:02:13 -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=Aia63Z1ocFN5mPcJWkaeV/Tr/0/uUVdZqjm/YjFrzfo=; b=gHoe0Dp/D1Op1PTUm2Bf0IcE2YRWmxuCD4NrefeWdlqEMbLEzPbIwBg28GYWej8ExS rVbuy/xSug41jbW3rlrsL1NxtxZ6aFsygOyKobV09n48Ankx+R/brx+qkGsACMqzSXX5 RQc+gpp5bovS2BQdXBmcl58q0pPpdUMeQYJvkUHxOSCoETqwSQP08Y7XYEonGzj39Po8 ylSKm86i0SuFoUz2/s/VLwkYHTeKMp2i8EcpwzP0R4zCcBmyPDQ0WnWkAoLRmOAsnK27 dUchVen/l0IWEIHT/8VmVKYGbMu1TDGpNlJYjaW98m85oIgaU2EuvnN2pEYdSg0Sndy2 LH2A== Received: by 10.50.160.198 with SMTP id xm6mr12193772igb.0.1339653732891; Wed, 13 Jun 2012 23:02:12 -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.231.24.148 with SMTP id v20csp62567ibb; Wed, 13 Jun 2012 23:02:12 -0700 (PDT) Received: by 10.180.78.233 with SMTP id e9mr1290377wix.5.1339653731610; Wed, 13 Jun 2012 23:02:11 -0700 (PDT) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id gf2si10048488wib.15.2012.06.13.23.02.11 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 13 Jun 2012 23:02: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 1Sf38F-0002yh-3O for ; Thu, 14 Jun 2012 06:02:11 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id 0EC6CE0017 for ; Thu, 14 Jun 2012 06:02:11 +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: 323 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-validation/lava-dispatcher/trunk] Rev 323: make lava-dispatch invoke lava dispatch, and make the latter's logging Message-Id: <20120614060211.360.42044.launchpad@ackee.canonical.com> Date: Thu, 14 Jun 2012 06:02:11 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="15405"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: 12d698dc1bc0d20aed5edadfddd323de66beda9c X-Gm-Message-State: ALoCoQmSFQHOOumQLNPDdCh9a58/fX3FtgqPcOhuKd9kqJTV1qmmUeuxNCXXR7GIov6RvrmkdVgS Merge authors: Michael Hudson-Doyle (mwhudson) Related merge proposals: https://code.launchpad.net/~mwhudson/lava-dispatcher/lava-space-dispatch-compat/+merge/110222 proposed by: Michael Hudson-Doyle (mwhudson) review: Approve - Andy Doan (doanac) ------------------------------------------------------------ revno: 323 [merge] committer: Michael Hudson-Doyle branch nick: trunk timestamp: Thu 2012-06-14 18:00:48 +1200 message: make lava-dispatch invoke lava dispatch, and make the latter's logging setup match the formers modified: lava-dispatch lava/dispatcher/commands.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-dispatch' --- lava-dispatch 2012-03-08 22:30:45 +0000 +++ lava-dispatch 2012-06-14 03:46:53 +0000 @@ -1,90 +1,2 @@ -#!/usr/bin/env python - -# Copyright (C) 2011 Linaro Limited -# -# Author: Paul Larson -# -# This file is part of LAVA Dispatcher. -# -# LAVA Dispatcher is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# LAVA Dispatcher is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, see . - -import optparse -import os -import sys -import logging.config - -from json_schema_validator.errors import ValidationError - -from lava_dispatcher.job import LavaTestJob, validate_job_data -from lava_dispatcher.config import get_config - -parser = optparse.OptionParser('%prog: lava-dispatch ') -parser.add_option( - "--oob-fd", default=None, type=int, help="Write OOB data to this fd.") -parser.add_option( - "--config-dir", - default=None if os.environ.get("VIRTUAL_ENV") is None else os.path.join(os.environ["VIRTUAL_ENV"], "etc", "lava-dispatcher"), - help="Configuration directory override (currently %default)") -parser.add_option( - "--validate", action='store_true', - help="Just validate the job file, do not execute any steps.") -parser.add_option( - "--job-id", action='store', default=None, - help="Set the scheduler job identifier. This alters process name for easier debugging") - -(options, args) = parser.parse_args() - - -if len(args) != 1: - parser.print_help() - sys.exit(1) - -if options.oob_fd: - oob_file = os.fdopen(options.oob_fd, 'w') -else: - oob_file = sys.stderr - -with open(args[0]) as fd: - jobdata = fd.read() - -# config the python logging - -FORMAT = '%(asctime)s %(levelname)s: %(message)s' -DATEFMT= '%Y-%m-%d %I:%M:%S %p' -logging.basicConfig(format=FORMAT,datefmt=DATEFMT) - -# Set process id if job-id was passed to dispatcher -if options.job_id: - try: - from setproctitle import getproctitle, setproctitle - except ImportError: - logging.warning("Unable to set import 'setproctitle', process name cannot be changed") - else: - setproctitle("%s [job: %s]" % (getproctitle(), options.job_id)) - - -config = get_config("lava-dispatcher", options.config_dir) -logging_level = config.get("LOGGING_LEVEL") -logging.root.setLevel(int(logging_level)) - -job = LavaTestJob(jobdata, oob_file, config) - -#FIXME Return status -if options.validate: - try: - validate_job_data(job.job_data) - except ValidationError as e: - print e -else: - job.run() +#!/bin/bash +exec lava dispatch "$@" === modified file 'lava/dispatcher/commands.py' --- lava/dispatcher/commands.py 2012-06-01 01:49:28 +0000 +++ lava/dispatcher/commands.py 2012-06-14 03:46:32 +0000 @@ -63,6 +63,10 @@ # config the python logging # FIXME: move to lava-tool + # XXX: this is horrible, but: undo the logging setup lava-tool has + # done. + del logging.root.handlers[:] + del logging.root.filters[:] FORMAT = '%(asctime)s %(levelname)s: %(message)s' DATEFMT= '%Y-%m-%d %I:%M:%S %p' logging.basicConfig(format=FORMAT,datefmt=DATEFMT)