=== modified file 'lava-dispatch'
@@ -1,90 +1,2 @@
-#!/usr/bin/env python
-
-# Copyright (C) 2011 Linaro Limited
-#
-# Author: Paul Larson <paul.larson@linaro.org>
-#
-# 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 <http://www.gnu.org/licenses>.
-
-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 <json job file>')
-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 = '<LAVA_DISPATCHER>%(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'
@@ -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 = '<LAVA_DISPATCHER>%(asctime)s %(levelname)s: %(message)s'
DATEFMT= '%Y-%m-%d %I:%M:%S %p'
logging.basicConfig(format=FORMAT,datefmt=DATEFMT)