Skip to content

Commit

Permalink
Merge pull request #500 from perftool-incubator/dev-kmr
Browse files Browse the repository at this point in the history
Dev kmr
  • Loading branch information
k-rister authored May 31, 2024
2 parents 98f9279 + 5fface0 commit 7808ec6
Show file tree
Hide file tree
Showing 2 changed files with 129 additions and 125 deletions.
129 changes: 128 additions & 1 deletion endpoints/endpoints.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
"""
Module with common code for use by all endpoints written in Python
"""

import argparse
import calendar
from fabric import Connection
from invoke import run
Expand Down Expand Up @@ -60,7 +65,7 @@ def run_remote(connection, command, validate = False, debug = False):
None
Returns:
a Fabric run result
Fabric run result (obj)
"""
debug_msg = "on remote '%s' as '%s' running command '%s'" % (connection.host, connection.user, command)
if validate:
Expand Down Expand Up @@ -1424,3 +1429,125 @@ def process_bench_roadblocks(callbacks = None, roadblock_id = None, endpoint_lab
log.info("Final summary of iteration sample data:\n%s" % (dump_json(iteration_sample_data)))

return 0

def process_options():
"""
Handle the CLI argument parsing options
Args:
None
Globals:
None
Returns:
args (namespace): The CLI parameters
"""
parser = argparse.ArgumentParser(description = "Endpoint to run 1 or more engines on 1 or more remotehost systems",
formatter_class = argparse.ArgumentDefaultsHelpFormatter)

parser.add_argument("--base-run-dir",
dest = "base_run_dir",
help = "The base directory where the run (and all it's components, data, results, etc.) are stored.",
required = True,
type = str)

parser.add_argument("--endpoint-deploy-timeout",
dest = "endpoint_deploy_timeout",
help = "How long should the timeout be for the endpoint deployment phase.",
required = False,
type = int,
default = 300)

parser.add_argument("--endpoint-index",
dest = "endpoint_index",
help = "What is the index into the run-file's endpoints array that is assigned to this instance of the endpoint.",
required = True,
type = int)

parser.add_argument("--endpoint-label",
dest = "endpoint_label",
help = "The name assigned to the endpoint, likely in the form <endpoint-type>-<id>.",
required = True,
type = str)

parser.add_argument("--engine-script-start-timeout",
dest = "engine_script_start_timeout",
help = "How long should the timeout be for the engine start phase.",
required = False,
type = int,
default = 300)

parser.add_argument("--image",
dest = "images",
help = "Comma separated list of images to use for particular tools/workloads.",
required = False,
type = str)

parser.add_argument("--log-level",
dest = "log_level",
help = "Allow the user to control the degree of verbosity of the output.",
required = False,
type = str,
choices = [ "debug", "normal" ],
default = "normal")

parser.add_argument("--max-rb-attempts",
dest = "max_rb_attempts",
help = "The maximum number of times a roadblock should be attempted if it fails.",
required = False,
type = int,
default = 1)

parser.add_argument("--max-sample-failures",
dest = "max_sample_failures",
help = "The maximum number of times an iteration's samples can fail before the iteration fails.",
required = False,
type = int,
default = 1)

parser.add_argument("--packrat-dir",
dest = "packrat_dir",
help = "Path to the packrat directory so that the endpoint can use it.",
required = False,
type = str)

parser.add_argument("--rickshaw-dir",
dest = "rickshaw_dir",
help = "Path to the root of the rickshaw project directory.",
required = True,
type = str)

parser.add_argument("--roadblock-id",
dest = "roadblock_id",
help = "The roadblock ID to use to build roadblock names.",
required = False,
type = str)

parser.add_argument("--roadblock-passwd",
dest = "roadblock_passwd",
help = "The password to pass to roadblock to make redis connections.",
required = False,
type = str)

parser.add_argument("--run-id",
dest = "run_id",
help = "The run identifier (generally a UUID) that is assigned to the run.",
required = False,
type = str)

parser.add_argument("--run-file",
dest = "run_file",
help = "The user supplied run-file that specifies all settings for the run.",
required = True,
type = str)

parser.add_argument("--validate",
dest = "validate",
help = "Signal that endpoint validation should be performed instead of actually running the endpoint.",
required = False,
action = "store_true")

args = parser.parse_args()

return args
125 changes: 1 addition & 124 deletions endpoints/remotehosts/remotehosts.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
Endpoint to run 1 or more engines on 1 or more remotehost systems
"""

import argparse
import base64
import copy
from fabric import Connection
Expand Down Expand Up @@ -54,128 +53,6 @@
"maximum-worker-threads-count": 250
}

def process_options():
"""
Handle the CLI argument parsing options
Args:
None
Globals:
None
Returns:
args (namespace): The CLI parameters
"""
parser = argparse.ArgumentParser(description = "Endpoint to run 1 or more engines on 1 or more remotehost systems",
formatter_class = argparse.ArgumentDefaultsHelpFormatter)

parser.add_argument("--base-run-dir",
dest = "base_run_dir",
help = "The base directory where the run (and all it's components, data, results, etc.) are stored.",
required = True,
type = str)

parser.add_argument("--endpoint-deploy-timeout",
dest = "endpoint_deploy_timeout",
help = "How long should the timeout be for the endpoint deployment phase.",
required = False,
type = int,
default = 300)

parser.add_argument("--endpoint-index",
dest = "endpoint_index",
help = "What is the index into the run-file's endpoints array that is assigned to this instance of the endpoint.",
required = True,
type = int)

parser.add_argument("--endpoint-label",
dest = "endpoint_label",
help = "The name assigned to the endpoint, likely in the form <endpoint-type>-<id>.",
required = True,
type = str)

parser.add_argument("--engine-script-start-timeout",
dest = "engine_script_start_timeout",
help = "How long should the timeout be for the engine start phase.",
required = False,
type = int,
default = 300)

parser.add_argument("--image",
dest = "images",
help = "Comma separated list of images to use for particular tools/workloads.",
required = False,
type = str)

parser.add_argument("--log-level",
dest = "log_level",
help = "Allow the user to control the degree of verbosity of the output.",
required = False,
type = str,
choices = [ "debug", "normal" ],
default = "normal")

parser.add_argument("--max-rb-attempts",
dest = "max_rb_attempts",
help = "The maximum number of times a roadblock should be attempted if it fails.",
required = False,
type = int,
default = 1)

parser.add_argument("--max-sample-failures",
dest = "max_sample_failures",
help = "The maximum number of times an iteration's samples can fail before the iteration fails.",
required = False,
type = int,
default = 1)

parser.add_argument("--packrat-dir",
dest = "packrat_dir",
help = "Path to the packrat directory so that the endpoint can use it.",
required = False,
type = str)

parser.add_argument("--rickshaw-dir",
dest = "rickshaw_dir",
help = "Path to the root of the rickshaw project directory.",
required = True,
type = str)

parser.add_argument("--roadblock-id",
dest = "roadblock_id",
help = "The roadblock ID to use to build roadblock names.",
required = False,
type = str)

parser.add_argument("--roadblock-passwd",
dest = "roadblock_passwd",
help = "The password to pass to roadblock to make redis connections.",
required = False,
type = str)

parser.add_argument("--run-id",
dest = "run_id",
help = "The run identifier (generally a UUID) that is assigned to the run.",
required = False,
type = str)

parser.add_argument("--run-file",
dest = "run_file",
help = "The user supplied run-file that specifies all settings for the run.",
required = True,
type = str)

parser.add_argument("--validate",
dest = "validate",
help = "Signal that endpoint validation should be performed instead of actually running the endpoint.",
required = False,
action = "store_true")

args = parser.parse_args()

return args

def validate():
"""
Validate the input and return configuration details to the caller
Expand Down Expand Up @@ -2664,7 +2541,7 @@ def main():
return rc

if __name__ == "__main__":
args = process_options()
args = endpoints.process_options()
log = None
settings = dict()
exit(main())

0 comments on commit 7808ec6

Please sign in to comment.