-#! /usr/bin/python3
+#! /usr/bin/env python3
# The goal is to introduce random failures in a simulation, to test simgrid under extreme conditions.
#
cmd_tell.append("--log=root.t:critical")
cmd_tell.append("--log=cmonkey.t:info")
cmd_tell.append("--log=cmonkey.fmt:%m%n")
- print(f"Get the initial info from the command ``{' '.join(cmd_tell)}``")
+ print(f"Get the initial info from the command.")
+ # print(f"from ``{' '.join(cmd_tell)}``")
first_run = subprocess.run(cmd_tell, shell=False, cwd=os.getcwd(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
if first_run.returncode != 0:
args = parser.parse_args()
(host_count, link_count, timestamps) = get_info(args.command)
-print(f"hosts:{host_count} links:{link_count} timestamps:{' '.join(([str(i) for i in timestamps]))}")
+print(f"Monkey informations: hosts:{host_count} links:{link_count} timestamps:{' '.join(([str(i) for i in timestamps]))}")
def do_run(cmd, extra_params):
cmd = copy.deepcopy(cmd)
cmd.append("--cfg=plugin:cmonkey")
for p in extra_params:
cmd.append(p)
- print(f"\n#################################################################################\nStart {' '.join(cmd)}")
+ print(f"Start {' '.join(cmd)}")
run = subprocess.run(cmd, shell=False, cwd=os.getcwd(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
if run.returncode != 0:
msg += str(run.stdout, errors='replace')
print(msg)
os.exit(1)
- print ("Success.")
+ print ("Success.\n")
def doit():
prev = 0
for pos in range(len(timestamps)):
now = timestamps[pos]
for host in range(host_count):
- do_run(args.command, [f"--cfg=cmonkey/time:{(now-prev)/2}",f"--cfg=cmonkey/host:{host}"])
+ do_run(args.command, [f"--cfg=cmonkey/time:{(now-prev)/2}", f"--cfg=cmonkey/host:{host}"])
+ do_run(args.command, [f"--cfg=cmonkey/time:{now}", f"--cfg=cmonkey/host:{host}"])
for link in range(link_count):
- do_run(args.command, [f"--cfg=cmonkey/time:{(now-prev)/2}",f"--cfg=cmonkey/link:{link}"])
+ do_run(args.command, [f"--cfg=cmonkey/time:{(now-prev)/2}", f"--cfg=cmonkey/link:{link}"])
+ do_run(args.command, [f"--cfg=cmonkey/time:{now}", f"--cfg=cmonkey/link:{link}"])
doit()