9
9
import subprocess
10
10
import re
11
11
import time
12
+ import os
12
13
13
14
class Handler (BaseHTTPRequestHandler ):
14
15
def do_POST (self ):
@@ -25,8 +26,10 @@ def do_POST(self):
25
26
prettyCmd = "taco " + cmd
26
27
cmd = cmd .replace ("\" " , "" )
27
28
28
- logFile = "/home/ubuntu/success.log"
29
- tacoPath = "/home/ubuntu/taco/build/bin/taco"
29
+ homeDir = os .path .expanduser ('~' )
30
+ logsDir = homeDir + "/web-tool-logs/"
31
+ logFile = logsDir + "/success.log"
32
+ tacoPath = "/taco/build/bin/taco"
30
33
31
34
prefix = "/tmp/" + str (threading .current_thread ().ident ) + "_"
32
35
writePath = prefix + "taco_kernel.c"
@@ -47,17 +50,17 @@ def do_POST(self):
47
50
response ['assembly-kernel' ] = assemblyKernel
48
51
except subprocess .TimeoutExpired :
49
52
response ['error' ] = 'Server is unable to process the request in a timely manner'
50
- logFile = "/home/ubuntu /timeout.log"
53
+ logFile = logsDir + " /timeout.log"
51
54
except subprocess .CalledProcessError as e :
52
55
search = re .compile (':\n .*\n ' ).search (e .output .decode ())
53
56
if search is not None :
54
57
response ['error' ] = search .group ()[3 :- 1 ]
55
58
else :
56
59
response ['error' ] = 'Expression and/or schedule is currently not supported'
57
- logFile = "/home/ubuntu /errors.log"
60
+ logFile = logsDir + " /errors.log"
58
61
except :
59
62
response ['error' ] = 'Expression and/or schedule is currently not supported'
60
- logFile = "/home/ubuntu /errors.log"
63
+ logFile = logsDir + " /errors.log"
61
64
62
65
ip = "." .join (self .client_address [0 ].split ('.' )[0 :- 2 ]) + ".*.*"
63
66
curTime = datetime .now ().isoformat (' ' )
0 commit comments