-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.py
32 lines (27 loc) · 937 Bytes
/
run.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import sys
from multiprocessing import Pool
import subprocess
import os
def process(filename):
os.environ["XRD_LOGLEVEL"] = "Dump"
converted_file = "root://xcache.cmsaf-dev.flatiron.hollandhpc.org:1094/" + filename.strip()
command = ["xrdcp", "--debug", "3", "-f", converted_file, "/dev/null"]
print(f'Running command: {command}')
command_output = subprocess.run(command)
print(f'Exit code of command {command}: {command_output.returncode}')
#print(filename)
def main():
# Get a few of the files
pool = Pool(10)
files = []
with open('files.txt', 'r') as file_list:
files = file_list.readlines()
# Get the argument, multiply by 100, and that's our start index
start_index = int(sys.argv[1]) * 100
files = files[start_index:start_index+100]
#files = files[:10]
pool.imap(process, files)
pool.close()
pool.join()
if __name__ == "__main__":
main()