-
Notifications
You must be signed in to change notification settings - Fork 290
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The dispatcher and supervisor were added in #1546, but code was copied and pasted into the new modules, leaving the worker untouched. Also untouched were the unit tests, meaning that the dispatcher and supervisor were never unit tested. As the copied code changed, the dispatcher and supervisor were not being tested for regressions, while the worker - which wasn't being anymore - had passing unit tests, giving some false sense of security. This commit removes the old worker code, and adapts the old worker tests to apply to the dispatcher and supervisor. It also splits out teuthology-supervisor into its own command. Signed-off-by: Zack Cerza <[email protected]>
- Loading branch information
Showing
11 changed files
with
483 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,50 @@ | ||
""" | ||
usage: teuthology-dispatcher --help | ||
teuthology-dispatcher --supervisor [-v] --bin-path BIN_PATH --job-config COFNFIG --archive-dir DIR | ||
teuthology-dispatcher [-v] [--archive-dir DIR] [--exit-on-empty-queue] --log-dir LOG_DIR --tube TUBE | ||
import argparse | ||
import sys | ||
|
||
Start a dispatcher for the specified tube. Grab jobs from a beanstalk | ||
queue and run the teuthology tests they describe as subprocesses. The | ||
subprocess invoked is a teuthology-dispatcher command run in supervisor | ||
mode. | ||
import teuthology.dispatcher | ||
|
||
Supervisor mode: Supervise the job run described by its config. Reimage | ||
target machines and invoke teuthology command. Unlock the target machines | ||
at the end of the run. | ||
|
||
standard arguments: | ||
-h, --help show this help message and exit | ||
-v, --verbose be more verbose | ||
-t, --tube TUBE which beanstalk tube to read jobs from | ||
-l, --log-dir LOG_DIR path in which to store logs | ||
-a DIR, --archive-dir DIR path to archive results in | ||
--supervisor run dispatcher in job supervisor mode | ||
--bin-path BIN_PATH teuthology bin path | ||
--job-config CONFIG file descriptor of job's config file | ||
--exit-on-empty-queue if the queue is empty, exit | ||
""" | ||
def parse_args(argv): | ||
parser = argparse.ArgumentParser( | ||
description="Start a dispatcher for the specified tube. Grab jobs from a beanstalk queue and run the teuthology tests they describe as subprocesses. The subprocess invoked is teuthology-supervisor." | ||
) | ||
parser.add_argument( | ||
"-v", | ||
"--verbose", | ||
action="store_true", | ||
help="be more verbose", | ||
) | ||
parser.add_argument( | ||
"-a", | ||
"--archive-dir", | ||
type=str, | ||
help="path to archive results in", | ||
) | ||
parser.add_argument( | ||
"-t", | ||
"--tube", | ||
type=str, | ||
help="which beanstalk tube to read jobs from", | ||
required=True, | ||
) | ||
parser.add_argument( | ||
"-l", | ||
"--log-dir", | ||
type=str, | ||
help="path in which to store the dispatcher log", | ||
required=True, | ||
) | ||
parser.add_argument( | ||
"--exit-on-empty-queue", | ||
action="store_true", | ||
help="if the queue is empty, exit", | ||
) | ||
return parser.parse_args(argv) | ||
|
||
import docopt | ||
import sys | ||
|
||
import teuthology.dispatcher | ||
def main(): | ||
sys.exit(teuthology.dispatcher.main(parse_args(sys.argv[1:]))) | ||
|
||
|
||
def main(): | ||
args = docopt.docopt(__doc__) | ||
sys.exit(teuthology.dispatcher.main(args)) | ||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import argparse | ||
import sys | ||
|
||
import teuthology.dispatcher.supervisor | ||
|
||
|
||
def parse_args(argv): | ||
parser = argparse.ArgumentParser( | ||
description="Supervise and run a teuthology job; normally only run by the dispatcher", | ||
) | ||
parser.add_argument( | ||
"-v", | ||
"--verbose", | ||
action="store_true", | ||
help="be more verbose", | ||
) | ||
parser.add_argument( | ||
"-a", | ||
"--archive-dir", | ||
type=str, | ||
help="path in which to store the job's logfiles", | ||
required=True, | ||
) | ||
parser.add_argument( | ||
"--bin-path", | ||
type=str, | ||
help="teuthology bin path", | ||
required=True, | ||
) | ||
parser.add_argument( | ||
"--job-config", | ||
type=str, | ||
help="file descriptor of job's config file", | ||
required=True, | ||
) | ||
return parser.parse_args(argv) | ||
|
||
|
||
def main(): | ||
sys.exit(teuthology.dispatcher.supervisor.main(parse_args(sys.argv[1:]))) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from script import Script | ||
|
||
|
||
class TestDispatcher(Script): | ||
script_name = 'teuthology-dispatcher' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from script import Script | ||
|
||
|
||
class TestSupervisor(Script): | ||
script_name = 'teuthology-supervisor' |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.