-
Notifications
You must be signed in to change notification settings - Fork 0
/
wms.py~
62 lines (47 loc) · 1.55 KB
/
wms.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
import subprocess
import json
class Wms:
def status(self):
cmd = ["condor_status"]
p = subprocess.Popen(cmd, stdout = subprocess.PIPE,
stderr=subprocess.PIPE,
stdin=subprocess.PIPE)
out,err = p.communicate()
jString = json.dumps({"status": out})
j = json.loads(jString)
return j
def job_Q(self):
cmd = ["condor_q"]
p = subprocess.Popen(cmd, stdout = subprocess.PIPE,
stderr=subprocess.PIPE,
stdin=subprocess.PIPE)
out,err = p.communicate()
jString = json.dumps({"job": out})
j = json.loads(jString)
return j
def log(self, log):
file = open(log, "r")
file_r = file.read()
jString = json.dumps({"output": file_r})
j = json.loads(jString)
return j
def output(self, output):
file=open(output,"r")
file_r=file.read()
jString = json.dumps({"output": file_r})
j = json.loads(jString)
return j
def submit(self, submit):
cmd = ["condor_submit",submit]
p = subprocess.Popen(cmd, stdout = subprocess.PIPE,
stderr=subprocess.PIPE,
stdin=subprocess.PIPE)
out,err = p.communicate()
jString = json.dumps({"submit": out})
j = json.loads(jString)
return j
def version(self):
v = "8.0.5"
return v
#obj2 = Wms()
#print(obj2.status())