-
Notifications
You must be signed in to change notification settings - Fork 2
/
submit_dag_jobs.py
42 lines (31 loc) · 1010 Bytes
/
submit_dag_jobs.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
33
34
35
36
37
38
39
40
41
import random
import os
import time
import htcondor
import shutil
schedd = htcondor.Schedd()
home = os.path.expanduser("~")
test_file = os.path.join(home, "condor_watch_q")
t = str(int(time.time()))
for x in range(1, 6):
log_dir = os.path.join(home, t, "{}".format(x))
if log_dir is not None:
try:
os.makedirs(os.path.dirname(log_dir))
except OSError:
pass
os.chdir(os.path.dirname(log_dir))
os.mkdir("{}".format(x))
os.chdir("{}".format(x))
shutil.copy(os.path.join(test_file, "test.dag"), os.getcwd())
shutil.copy(os.path.join(test_file, "test.condor"), os.getcwd())
os.rename("test.dag", "test{}.dag".format(x))
sub = htcondor.Submit.from_dag("test{}.dag".format(x))
with schedd.transaction() as txn:
sub.queue(txn)
os.system("condor_q")
print()
# os.chdir(os.path.join(home, "deeply", "nested"))
# os.chdir(os.path.expanduser("~"))
print("Running from", os.getcwd())
print("-" * 40)