in cstar/cstarcli.py [0:0]
def execute_command(args):
cstar.output.debug(args)
command = args.command
msg("Command : ", command)
if bool(args.seed_host) + bool(args.host) + bool(args.host_file) != 1:
error("Exactly one of --seed-host, --host and --host-file must be used", print_traceback=False)
computed_args = args_from_strategy_shortcut(copy.deepcopy(args))
hosts = None
if args.host_file:
with open(args.host_file) as f:
hosts = f.read().splitlines()
if args.host:
hosts = args.host
hosts_variables = dict()
if args.hosts_variables:
with open(args.hosts_variables) as f:
hosts_variables = json.loads(f.read())
with cstar.job.Job() as job:
env = dict((arg.name, getattr(args, arg.name)) for arg in command.arguments)
if bool(args.enforced_job_id) == 1:
job_id = args.enforced_job_id
if not(validate_uuid4(job_id)):
raise BadArgument("Job id is not a valid UUID v4 value.")
else:
job_id = str(uuid.uuid4())
msg("Job id is", emph(job_id))
msg("Running", command.file)
msg("env", env)
cstar.signalhandler.print_message_and_save_on_sigint(job, job_id)
job.setup(
hosts=hosts,
seeds=args.seed_host,
command=command.file,
job_id=job_id,
strategy=cstar.strategy.parse(fallback(computed_args.strategy, args.strategy, command.strategy, "topology")),
cluster_parallel=fallback(args.cluster_parallel, command.cluster_parallel, False),
dc_parallel=fallback(computed_args.dc_parallel, args.dc_parallel, command.dc_parallel, False),
max_concurrency=args.max_concurrency,
timeout=args.timeout,
env=env,
use_sudo=args.use_sudo,
sudo_args=args.sudo_args,
stop_after=args.stop_after,
job_runner=cstar.jobrunner.RemoteJobRunner,
key_space=args.key_space,
output_directory=args.output_directory,
ignore_down_nodes=args.ignore_down_nodes,
dc_filter=args.dc_filter,
sleep_on_new_runner=args.ssh_pause_time,
sleep_after_done=args.node_done_pause_time,
ssh_username=args.ssh_username,
ssh_password=args.ssh_password,
ssh_identity_file=args.ssh_identity_file,
ssh_lib=args.ssh_lib,
jmx_username=args.jmx_username,
jmx_password=args.jmx_password,
jmx_passwordfile=args.jmx_passwordfile,
addl_jmx_args=args.jmx_addlargs,
resolve_hostnames=args.resolve_hostnames,
hosts_variables=hosts_variables)
job.run()