def parse_args(args): """ create the parser, parse the arguments and set up logging :returns tuple of parser and parsed arguments """ parser = argparse.ArgumentParser( description="Expand an alias to a server ip address.") parser.add_argument("-d", "--debug", action="store_true", help="enable debug output") parser.add_argument("-e", "--export", action="store_true", help="enable output as shell export") parser.add_argument("--log-file", default="/tmp/expand.log", help="path to log file") parser.add_argument("host", metavar="host", type=str, help="the alias to expand and convert to an ip") arguments = parser.parse_args(args) setup_logging(arguments.debug, arguments.log_file) return arguments
def parse_command_line(config, args=None): """ Parse the command line options for setting up a working directory :param dict config: The bootstrap.py config, populated from cli options. (NOT ConfigDict.) :param list args: Command line arguments to pass to argparse. """ parser = argparse.ArgumentParser( description="Setup DSI working environment. For instructions \ on setting up dsi locally, see \ https://drive.google.com/open?id=14QXOmo-ia8w72pW5zqQ2fCWfXEwiVQ8_1EoMCkB4baY" ) parser.add_argument( "-b", "--bootstrap-file", help="Specify the bootstrap file. If not specified, will look for " "bootstrap.yml in the current directory. ", ) parser.add_argument("-d", "--debug", action="store_true", help="enable debug output") parser.add_argument( "-D", "--directory", default=".", help="Directory to setup. Defaults to current directory") parser.add_argument("--log-file", help="path to log file") # These options are ignored but allowed for backward compatibility parser.add_argument("--production", action="store_true", default=False, help="(Ignored)") parser.add_argument("-v", "--verbose", action="store_true", help="(Ignored, use -d instead.)") parser.add_argument( "-l", "--symlink", action="store_true", default=False, help="Symlink files instead of copying them.", ) args = parser.parse_args(args) setup_logging(args.debug, args.log_file) # pylint: disable=no-member if args.bootstrap_file: config["bootstrap_file"] = args.bootstrap_file if args.directory: config["directory"] = args.directory if args.symlink: config["symlink"] = args.symlink return config
def main(): """ Main function """ args = parse_command_line() setup_logging(args.debug, args.log_file) config = ConfigDict("infrastructure_provisioning") config.load() provisioner = Provisioner(config, verbose=args.debug) provisioner.provision_resources()
def main(argv=sys.argv[1:]): """ Parse args and call workload_setup.yml operations """ parser = argparse.ArgumentParser(description="Workload Setup") parser.add_argument("-d", "--debug", action="store_true", help="enable debug output") parser.add_argument("--log-file", help="path to log file") args = parser.parse_args(argv) setup_logging(args.debug, args.log_file) config = ConfigDict("workload_setup") config.load() setup = WorkloadSetupRunner(config) setup.setup_workloads()
def parse_args(args): """ create the parser, parse the arguments and set up logging :returns tuple of parser and parsed arguments """ parser = argparse.ArgumentParser( description="Create a connection to the remote server.\ For instructions on setting up dsi locally" ) parser.add_argument("-d", "--debug", action="store_true", help="enable debug output") parser.add_argument( "--dryrun", action="store_true", default=False, help="Do not run the command, just evaluate it.", ) parser.add_argument("--log-file", help="path to log file") parser.add_argument("-s", "--ssh", default="ssh", help="the ssh location") parser.add_argument("host", metavar="host", nargs="+", type=str, help="the path of the host to connect to") parser.add_argument( "-c", "--command", metavar="command", nargs="?", action="append", default=[], help="the remote command to run", ) arguments = parser.parse_args(args) setup_logging(arguments.debug, arguments.log_file) return parser, arguments
def main(argv): """ Main function. Parse command line options, and run tests. :returns: int the exit status to return to the caller (0 for OK) """ parser = argparse.ArgumentParser(description="DSI Test runner") parser.add_argument("-d", "--debug", action="store_true", help="enable debug output") parser.add_argument("--log-file", help="path to log file") args = parser.parse_args(argv) log.setup_logging(args.debug, args.log_file) config = ConfigDict("test_control") config.load() error = run_tests(config) return 1 if error else 0
def main(argv): """ Main function. Parse command line options, and run analysis. Note that the return value here determines whether Evergreen considers the entire task passed or failed. Non-zero return value means failure. :returns: int the exit status to return to the caller (0 for OK) """ parser = argparse.ArgumentParser(description="Analyze DSI test results.") parser.add_argument("-d", "--debug", action="store_true", help="enable debug output") parser.add_argument("--log-file", help="path to log file") args = parser.parse_args(argv) setup_logging(args.debug, args.log_file) config = ConfigDict("analysis") config.load() analyzer = ResultsAnalyzer(config) analyzer.analyze_all() return 1 if analyzer.failures > 0 else 0
def main(): """ Handle the main functionality (parse args /setup logging ) and then start the mongodb cluster.""" args = parse_command_line() setup_logging(args.debug, args.log_file) config = ConfigDict("mongodb_setup") config.load() # Start MongoDB cluster(s) using config given in mongodb_setup.topology (if any). # Note: This also installs mongo client binary onto workload client. mongo = MongodbSetup(config=config) # Reset delays before starting so delays don't break setup. mongo.client.reset_delays() for cluster in mongo.clusters: cluster.reset_delays() start_cluster(mongo, config) # Establish delays *after* the cluster is started so delays won't interfere with setup. mongo.client.establish_delays() for cluster in mongo.clusters: cluster.establish_delays()