-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathcondorify_gpu_email
executable file
·72 lines (54 loc) · 1.37 KB
/
condorify_gpu_email
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
68
69
70
71
72
#!/usr/bin/env python
"""
A very simple wrapper for a function call, making a corresponding condor script
and submitting it.
"""
import os, sys
CondorScript = """
universe = vanilla
#+GPUJob = true
#requirements = GPU
#requirements = TARGET.GPUSlot
#requirements = TARGET.GPUSlot && NumJobStarts == 0
requirements = InMastodon
#notify_user = [email protected]
#Notification = Complete
#request_GPUs = 1
#request_memory = 16 * 1024
#request_memory = 4 * 1024
getenv = true
Initialdir = %s
Executable = %s
%s
+Group = "GRAD"
+Project = "AI_ROBOTICS"
+ProjectDescription = "BWI research"
Arguments = %s
Queue
"""
#OutputLine = """
#Error = err.%s
#Output = %s
#Log = results.log
#"""
OutputLine = """
Error = err.%s
Output = %s
Log = results.log
"""
RawExecutable = sys.argv[1]
Arguments = ' '.join(sys.argv[2:-1])
OutputFile = sys.argv[-1]
Executable = os.popen('/bin/which %s' % RawExecutable).read()
CurrentDir = os.popen('/bin/pwd').read()
# remove path information
SafeOutputFile = '-'.join(OutputFile.split('/'))
if OutputFile == "/dev/null":
outputlines = ""
else:
outputlines = OutputLine % (SafeOutputFile, OutputFile)
condor_file = '/tmp/%s.condor' % (SafeOutputFile)
f = open(condor_file, 'w')
f.write(CondorScript % (CurrentDir, Executable, outputlines, Arguments))
f.close()
os.popen('/lusr/opt/condor/bin/condor_submit %s' % condor_file)