-
Notifications
You must be signed in to change notification settings - Fork 2
/
submit_test_jobs.py
67 lines (56 loc) · 1.46 KB
/
submit_test_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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import random
import os
import time
import htcondor
schedd = htcondor.Schedd()
home = os.path.expanduser("~")
t = str(int(time.time()))
for x in range(1, 6):
log = os.path.join(home, t, "{}.log".format(x))
# if x == 2:
# log = os.path.join(
# home,
# "deeply",
# "nested",
# "path",
# "to",
# "veryveryveryveryveryveryveryveryverylong",
# "{}.log".format(x),
# )
# if x == 3:
# log = os.path.join(
# home,
# "deeply",
# "nested",
# "path",
# "to",
# "veryveryveryberrylong",
# "{}.log".format(x),
# )
# if x == 4:
# log = None
if log is not None:
try:
os.makedirs(os.path.dirname(log))
except OSError:
pass
s = dict(
executable="/bin/sleep",
arguments="10",
hold=False,
transfer_input_files="nope" if x == 4 else "",
jobbatchname="batch {}".format(10 - x),
)
if log is not None:
s["log"] = log
sub = htcondor.Submit(s)
with schedd.transaction() as txn:
sub.queue(txn, random.randint(1, 5))
with schedd.transaction() as txn:
sub.queue(txn, random.randint(1, 5))
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)