You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
PurpleDome/experiment_control.py

44 lines
1.1 KiB
Python

#!/usr/bin/env python3
""" The main tool to run experiments """
import argparse
from app.experimentcontrol import Experiment
# TODO: Add verbose settings: -v to -vvv
# TODO: Name experiments. Name will be written to the log
def explain(args): # pylint: disable=unused-argument
""" Explain the tool"""
print("Please specify a command to execute. For a list see <help>")
def run(args):
""" Run experiments
@param args: arguments from the argparse parser
"""
Experiment(args.configfile)
def create_parser():
""" Creates the parser for the command line arguments"""
parser = argparse.ArgumentParser("Controls an experiment on the configured systems")
subparsers = parser.add_subparsers(help="sub-commands")
parser.set_defaults(func=explain)
# Sub parser for machine creation
parser_run = subparsers.add_parser("run", help="run experiments")
parser_run.set_defaults(func=run)
parser_run.add_argument("--configfile", default="experiment.yaml", help="Config file to create from")
return parser
if __name__ == "__main__":
arguments = create_parser().parse_args()
arguments.func(arguments)