mirror of
https://github.com/ceph/ceph
synced 2025-03-23 10:48:12 +00:00
Move teuthology-schedule's arg parsing to scripts/
Signed-off-by: Zack Cerza <zack.cerza@inktank.com>
This commit is contained in:
parent
a6b57cc136
commit
c784c79f1d
99
scripts/schedule.py
Normal file
99
scripts/schedule.py
Normal file
@ -0,0 +1,99 @@
|
||||
import argparse
|
||||
|
||||
from teuthology.run import config_file
|
||||
from teuthology.run import MergeConfig
|
||||
from teuthology.run import schedule
|
||||
|
||||
|
||||
def parse_args():
|
||||
parser = argparse.ArgumentParser(
|
||||
description='Schedule ceph integration tests')
|
||||
parser.add_argument(
|
||||
'config',
|
||||
metavar='CONFFILE',
|
||||
nargs='*',
|
||||
type=config_file,
|
||||
action=MergeConfig,
|
||||
default={},
|
||||
help='config file to read',
|
||||
)
|
||||
parser.add_argument(
|
||||
'--name',
|
||||
help='name of suite run the job is part of',
|
||||
)
|
||||
parser.add_argument(
|
||||
'--last-in-suite',
|
||||
action='store_true',
|
||||
default=False,
|
||||
help='mark the last job in a suite so suite post-processing can be ' +
|
||||
'run',
|
||||
)
|
||||
parser.add_argument(
|
||||
'--email',
|
||||
help='where to send the results of a suite (only applies to the ' +
|
||||
'last job in a suite)',
|
||||
)
|
||||
parser.add_argument(
|
||||
'--timeout',
|
||||
help='how many seconds to wait for jobs to finish before emailing ' +
|
||||
'results (only applies to the last job in a suite',
|
||||
type=int,
|
||||
)
|
||||
parser.add_argument(
|
||||
'--description',
|
||||
help='job description',
|
||||
)
|
||||
parser.add_argument(
|
||||
'--owner',
|
||||
help='job owner',
|
||||
)
|
||||
parser.add_argument(
|
||||
'--delete',
|
||||
metavar='JOBID',
|
||||
type=int,
|
||||
nargs='*',
|
||||
help='list of jobs to remove from the queue',
|
||||
)
|
||||
parser.add_argument(
|
||||
'-n', '--num',
|
||||
default=1,
|
||||
type=int,
|
||||
help='number of times to run/queue the job'
|
||||
)
|
||||
parser.add_argument(
|
||||
'-p', '--priority',
|
||||
default=1000,
|
||||
type=int,
|
||||
help='beanstalk priority (lower is sooner)'
|
||||
)
|
||||
parser.add_argument(
|
||||
'-v', '--verbose',
|
||||
action='store_true',
|
||||
default=False,
|
||||
help='be more verbose',
|
||||
)
|
||||
parser.add_argument(
|
||||
'-w', '--worker',
|
||||
default='plana',
|
||||
help='which worker to use (type of machine)',
|
||||
)
|
||||
parser.add_argument(
|
||||
'-s', '--show',
|
||||
metavar='JOBID',
|
||||
type=int,
|
||||
nargs='*',
|
||||
help='output the contents of specified jobs in the queue',
|
||||
)
|
||||
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
def main():
|
||||
args = parse_args()
|
||||
if not args.last_in_suite:
|
||||
msg = '--email is only applicable to the last job in a suite'
|
||||
assert not args.email, msg
|
||||
msg = '--timeout is only applicable to the last job in a suite'
|
||||
assert not args.timeout, msg
|
||||
schedule(args)
|
||||
|
2
setup.py
2
setup.py
@ -22,7 +22,7 @@ setup(
|
||||
'teuthology-ls = scripts.ls:main',
|
||||
'teuthology-worker = scripts.worker:main',
|
||||
'teuthology-lock = scripts.lock:main',
|
||||
'teuthology-schedule = teuthology.run:schedule',
|
||||
'teuthology-schedule = scripts.schedule:main',
|
||||
'teuthology-updatekeys = teuthology.lock:update_hostkeys',
|
||||
'teuthology-coverage = teuthology.coverage:analyze',
|
||||
'teuthology-results = teuthology.suite:results',
|
||||
|
@ -284,93 +284,7 @@ def main():
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def schedule():
|
||||
parser = argparse.ArgumentParser(
|
||||
description='Schedule ceph integration tests')
|
||||
parser.add_argument(
|
||||
'config',
|
||||
metavar='CONFFILE',
|
||||
nargs='*',
|
||||
type=config_file,
|
||||
action=MergeConfig,
|
||||
default={},
|
||||
help='config file to read',
|
||||
)
|
||||
parser.add_argument(
|
||||
'--name',
|
||||
help='name of suite run the job is part of',
|
||||
)
|
||||
parser.add_argument(
|
||||
'--last-in-suite',
|
||||
action='store_true',
|
||||
default=False,
|
||||
help='mark the last job in a suite so suite post-processing can be ' +
|
||||
'run',
|
||||
)
|
||||
parser.add_argument(
|
||||
'--email',
|
||||
help='where to send the results of a suite (only applies to the ' +
|
||||
'last job in a suite)',
|
||||
)
|
||||
parser.add_argument(
|
||||
'--timeout',
|
||||
help='how many seconds to wait for jobs to finish before emailing ' +
|
||||
'results (only applies to the last job in a suite',
|
||||
type=int,
|
||||
)
|
||||
parser.add_argument(
|
||||
'--description',
|
||||
help='job description',
|
||||
)
|
||||
parser.add_argument(
|
||||
'--owner',
|
||||
help='job owner',
|
||||
)
|
||||
parser.add_argument(
|
||||
'--delete',
|
||||
metavar='JOBID',
|
||||
type=int,
|
||||
nargs='*',
|
||||
help='list of jobs to remove from the queue',
|
||||
)
|
||||
parser.add_argument(
|
||||
'-n', '--num',
|
||||
default=1,
|
||||
type=int,
|
||||
help='number of times to run/queue the job'
|
||||
)
|
||||
parser.add_argument(
|
||||
'-p', '--priority',
|
||||
default=1000,
|
||||
type=int,
|
||||
help='beanstalk priority (lower is sooner)'
|
||||
)
|
||||
parser.add_argument(
|
||||
'-v', '--verbose',
|
||||
action='store_true',
|
||||
default=False,
|
||||
help='be more verbose',
|
||||
)
|
||||
parser.add_argument(
|
||||
'-w', '--worker',
|
||||
default='plana',
|
||||
help='which worker to use (type of machine)',
|
||||
)
|
||||
parser.add_argument(
|
||||
'-s', '--show',
|
||||
metavar='JOBID',
|
||||
type=int,
|
||||
nargs='*',
|
||||
help='output the contents of specified jobs in the queue',
|
||||
)
|
||||
|
||||
ctx = parser.parse_args()
|
||||
if not ctx.last_in_suite:
|
||||
msg = '--email is only applicable to the last job in a suite'
|
||||
assert not ctx.email, msg
|
||||
msg = '--timeout is only applicable to the last job in a suite'
|
||||
assert not ctx.timeout, msg
|
||||
|
||||
def schedule(ctx):
|
||||
from teuthology.misc import read_config, get_user
|
||||
if ctx.owner is None:
|
||||
ctx.owner = 'scheduled_{user}'.format(user=get_user())
|
||||
|
Loading…
Reference in New Issue
Block a user