Skip to content

Commit 687d8b6

Browse files
author
Michael Hudson-Doyle
committed
take lava-dispatch away and replace it with a shell compatibility shim
1 parent e9abca7 commit 687d8b6

File tree

1 file changed

+2
-90
lines changed

1 file changed

+2
-90
lines changed

lava-dispatch

+2-90
Original file line numberDiff line numberDiff line change
@@ -1,90 +1,2 @@
1-
#!/usr/bin/env python
2-
3-
# Copyright (C) 2011 Linaro Limited
4-
#
5-
# Author: Paul Larson <[email protected]>
6-
#
7-
# This file is part of LAVA Dispatcher.
8-
#
9-
# LAVA Dispatcher is free software; you can redistribute it and/or modify
10-
# it under the terms of the GNU General Public License as published by
11-
# the Free Software Foundation; either version 2 of the License, or
12-
# (at your option) any later version.
13-
#
14-
# LAVA Dispatcher is distributed in the hope that it will be useful,
15-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
16-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17-
# GNU General Public License for more details.
18-
#
19-
# You should have received a copy of the GNU General Public License along
20-
# with this program; if not, see <http://www.gnu.org/licenses>.
21-
22-
import optparse
23-
import os
24-
import sys
25-
import logging.config
26-
27-
from json_schema_validator.errors import ValidationError
28-
29-
from lava_dispatcher.job import LavaTestJob, validate_job_data
30-
from lava_dispatcher.config import get_config
31-
32-
parser = optparse.OptionParser('%prog: lava-dispatch <json job file>')
33-
parser.add_option(
34-
"--oob-fd", default=None, type=int, help="Write OOB data to this fd.")
35-
parser.add_option(
36-
"--config-dir",
37-
default=None if os.environ.get("VIRTUAL_ENV") is None else os.path.join(os.environ["VIRTUAL_ENV"], "etc", "lava-dispatcher"),
38-
help="Configuration directory override (currently %default)")
39-
parser.add_option(
40-
"--validate", action='store_true',
41-
help="Just validate the job file, do not execute any steps.")
42-
parser.add_option(
43-
"--job-id", action='store', default=None,
44-
help="Set the scheduler job identifier. This alters process name for easier debugging")
45-
46-
(options, args) = parser.parse_args()
47-
48-
49-
if len(args) != 1:
50-
parser.print_help()
51-
sys.exit(1)
52-
53-
if options.oob_fd:
54-
oob_file = os.fdopen(options.oob_fd, 'w')
55-
else:
56-
oob_file = sys.stderr
57-
58-
with open(args[0]) as fd:
59-
jobdata = fd.read()
60-
61-
# config the python logging
62-
63-
FORMAT = '<LAVA_DISPATCHER>%(asctime)s %(levelname)s: %(message)s'
64-
DATEFMT= '%Y-%m-%d %I:%M:%S %p'
65-
logging.basicConfig(format=FORMAT,datefmt=DATEFMT)
66-
67-
# Set process id if job-id was passed to dispatcher
68-
if options.job_id:
69-
try:
70-
from setproctitle import getproctitle, setproctitle
71-
except ImportError:
72-
logging.warning("Unable to set import 'setproctitle', process name cannot be changed")
73-
else:
74-
setproctitle("%s [job: %s]" % (getproctitle(), options.job_id))
75-
76-
77-
config = get_config("lava-dispatcher", options.config_dir)
78-
logging_level = config.get("LOGGING_LEVEL")
79-
logging.root.setLevel(int(logging_level))
80-
81-
job = LavaTestJob(jobdata, oob_file, config)
82-
83-
#FIXME Return status
84-
if options.validate:
85-
try:
86-
validate_job_data(job.job_data)
87-
except ValidationError as e:
88-
print e
89-
else:
90-
job.run()
1+
#!/bin/bash
2+
exec lava dispatch "$@"

0 commit comments

Comments
 (0)