Add default value of stderrpath and stdoutpath
This commit is contained in:
parent
473e2925c0
commit
754d92857c
|
@ -10,13 +10,13 @@ def run():
|
||||||
channel = grpc.insecure_channel('localhost:50051')
|
channel = grpc.insecure_channel('localhost:50051')
|
||||||
stub = rpc_pb2_grpc.WorkerStub(channel)
|
stub = rpc_pb2_grpc.WorkerStub(channel)
|
||||||
|
|
||||||
comm = rpc_pb2.Command(commandLine="python3 CNN.py", packagePath="/root/nfs/17flowers", envVars={'test1':'10','test2':'20'}) # | awk '{print \"test\\\"\\n\"}'
|
comm = rpc_pb2.Command(commandLine="ls /root/oss/test-for-docklet", packagePath="/root", envVars={'test1':'10','test2':'20'}) # | awk '{print \"test\\\"\\n\"}'
|
||||||
paras = rpc_pb2.Parameters(command=comm, stderrRedirectPath="/root/nfs/", stdoutRedirectPath="")
|
paras = rpc_pb2.Parameters(command=comm, stderrRedirectPath="/root/oss/test-for-docklet/", stdoutRedirectPath="/root/oss/test-for-docklet/")
|
||||||
|
|
||||||
img = rpc_pb2.Image(name="17flowers", type=rpc_pb2.Image.PRIVATE, owner="root")
|
img = rpc_pb2.Image(name="base", type=rpc_pb2.Image.BASE, owner="docklet")
|
||||||
inst = rpc_pb2.Instance(cpu=4, memory=4000, disk=8000, gpu=2)
|
inst = rpc_pb2.Instance(cpu=1, memory=1000, disk=1000, gpu=0)
|
||||||
mnt = rpc_pb2.Mount(localPath="",provider='aliyun',remotePath="test-for-docklet",other="oss-cn-beijing.aliyuncs.com",accessKey="LTAIdl7gmmIhfqA9",secretKey="")
|
mnt = rpc_pb2.Mount(localPath="",provider='aliyun',remotePath="test-for-docklet",other="oss-cn-beijing.aliyuncs.com",accessKey="LTAIdl7gmmIhfqA9",secretKey="")
|
||||||
clu = rpc_pb2.Cluster(image=img, instance=inst, mount=[])
|
clu = rpc_pb2.Cluster(image=img, instance=inst, mount=[mnt])
|
||||||
|
|
||||||
task = rpc_pb2.TaskInfo(id="test",username="root",instanceid=1,instanceCount=1,maxRetryCount=1,parameters=paras,cluster=clu,timeout=60000,token="test")
|
task = rpc_pb2.TaskInfo(id="test",username="root",instanceid=1,instanceCount=1,maxRetryCount=1,parameters=paras,cluster=clu,timeout=60000,token="test")
|
||||||
|
|
||||||
|
|
|
@ -287,7 +287,7 @@ class TaskController(rpc_pb2_grpc.WorkerServicer):
|
||||||
|
|
||||||
def write_output(self,lxcname,tmplogpath,filepath):
|
def write_output(self,lxcname,tmplogpath,filepath):
|
||||||
cmd = "lxc-attach -n " + lxcname + " -- mv %s %s"
|
cmd = "lxc-attach -n " + lxcname + " -- mv %s %s"
|
||||||
if filepath == "" or filepath == "/root/nfs"+tmplogpath or os.path.abspath("/root/nfs/"+tmplogpath) == os.path.abspath(filepath):
|
if filepath == "" or filepath == "/root/nfs/batch_{jobid}/" or os.path.abspath("/root/nfs/"+tmplogpath) == os.path.abspath(filepath):
|
||||||
return [True,""]
|
return [True,""]
|
||||||
ret = subprocess.run(cmd % ("/root/nfs/"+tmplogpath,filepath),stdout=subprocess.PIPE,stderr=subprocess.STDOUT, shell=True)
|
ret = subprocess.run(cmd % ("/root/nfs/"+tmplogpath,filepath),stdout=subprocess.PIPE,stderr=subprocess.STDOUT, shell=True)
|
||||||
if ret.returncode != 0:
|
if ret.returncode != 0:
|
||||||
|
@ -350,10 +350,6 @@ class TaskController(rpc_pb2_grpc.WorkerServicer):
|
||||||
logger.info("Running time(%d) is out. Task(%s-%s-%s) will be killed." % (timeout,str(taskid),str(instanceid),token))
|
logger.info("Running time(%d) is out. Task(%s-%s-%s) will be killed." % (timeout,str(taskid),str(instanceid),token))
|
||||||
self.add_msg(taskid,username,instanceid,rpc_pb2.TIMEOUT,token,"Running time is out.")
|
self.add_msg(taskid,username,instanceid,rpc_pb2.TIMEOUT,token,"Running time is out.")
|
||||||
else:
|
else:
|
||||||
if len(outpath[0]) > 0 and outpath[0][-1] == "/":
|
|
||||||
outpath[0] += stdoutname
|
|
||||||
if len(outpath[1]) > 0 and outpath[1][-1] == "/":
|
|
||||||
outpath[1] += stderrname
|
|
||||||
[success1,msg1] = self.write_output(lxcname,jobdir+"/"+stdoutname,outpath[0])
|
[success1,msg1] = self.write_output(lxcname,jobdir+"/"+stdoutname,outpath[0])
|
||||||
[success2,msg2] = self.write_output(lxcname,jobdir+"/"+stderrname,outpath[1])
|
[success2,msg2] = self.write_output(lxcname,jobdir+"/"+stderrname,outpath[1])
|
||||||
if not success1 or not success2:
|
if not success1 or not success2:
|
||||||
|
|
|
@ -172,10 +172,10 @@
|
||||||
+'</div>Seconds</div>'
|
+'</div>Seconds</div>'
|
||||||
+'<div class="form-group">'
|
+'<div class="form-group">'
|
||||||
+'<label class="col-sm-2 control-label">Stderr Redirect Path</label>'
|
+'<label class="col-sm-2 control-label">Stderr Redirect Path</label>'
|
||||||
+'<div class="col-sm-3"><input type="text" class="form-control" placeholder="/path/to/file or /path/" name="stdErrRedPth_' + task_number + '" id="stdErrRedPth_' + task_number + '" />'
|
+'<div class="col-sm-3"><input type="text" class="form-control" placeholder="/path/to/file or /path/" name="stdErrRedPth_' + task_number + '" id="stdErrRedPth_' + task_number + '" value="/root/nfs/batch_{jobid}/" />'
|
||||||
+'</div>'
|
+'</div>'
|
||||||
+'<label class="col-sm-2 control-label">Stdout Redirect Path</label>'
|
+'<label class="col-sm-2 control-label">Stdout Redirect Path</label>'
|
||||||
+'<div class="col-sm-3"><input type="text" class="form-control" placeholder="/path/to/file or /path/" name="stdOutRedPth_' + task_number + '" id="stdOutRedPth_' + task_number + '" />'
|
+'<div class="col-sm-3"><input type="text" class="form-control" placeholder="/path/to/file or /path/" name="stdOutRedPth_' + task_number + '" id="stdOutRedPth_' + task_number + '" value="/root/nfs/batch_{jobid}/" />'
|
||||||
+'</div></div>'
|
+'</div></div>'
|
||||||
+'<div class="form-group">'
|
+'<div class="form-group">'
|
||||||
+'<label class="col-sm-2 control-label">Dependency <i class="fa fa-question-circle" title="The tasks that this task depends on, seperate them with commas, eg: task_1, task_2"></i></label>'
|
+'<label class="col-sm-2 control-label">Dependency <i class="fa fa-question-circle" title="The tasks that this task depends on, seperate them with commas, eg: task_1, task_2"></i></label>'
|
||||||
|
|
Loading…
Reference in New Issue