TP-recherche-operationnelle/distrib.py

18 lines
629 B
Python
Raw Normal View History

PATH = "data"
import os
result = [os.path.join(dp, f) for dp, dn, filenames in os.walk(PATH) for f in filenames if os.path.splitext(f)[1] == '.opb']
with open("machines.txt") as file:
machines = file.readlines()
machines = [machine.rstrip() for machine in machines]
i = 0
while len(result) > 0:
knap = result.pop()[:-4]
victime = machines[i % len(machines)]
i+=1
2021-12-09 11:03:00 +00:00
cmd = f"""ssh lfainsin@{victime} -o "ConnectTimeout 3" -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" "cd 2A/RO/tp2/ && tmux new-session -d 'julia test.jl {knap}.opb > {knap}.stdout'" """
print(cmd)
os.system(cmd)