diff --git a/src/master/testTaskCtrler.py b/src/master/testTaskCtrler.py index be36ef3..ba6b947 100644 --- a/src/master/testTaskCtrler.py +++ b/src/master/testTaskCtrler.py @@ -10,13 +10,13 @@ def run(): channel = grpc.insecure_channel('localhost:50051') 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\"}' - paras = rpc_pb2.Parameters(command=comm, stderrRedirectPath="/root/nfs/", stdoutRedirectPath="") + 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/oss/test-for-docklet/", stdoutRedirectPath="/root/oss/test-for-docklet/") - img = rpc_pb2.Image(name="17flowers", type=rpc_pb2.Image.PRIVATE, owner="root") - inst = rpc_pb2.Instance(cpu=4, memory=4000, disk=8000, gpu=2) + img = rpc_pb2.Image(name="base", type=rpc_pb2.Image.BASE, owner="docklet") + 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="") - 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") diff --git a/src/worker/taskcontroller.py b/src/worker/taskcontroller.py index b42bd37..fd055e0 100755 --- a/src/worker/taskcontroller.py +++ b/src/worker/taskcontroller.py @@ -287,7 +287,7 @@ class TaskController(rpc_pb2_grpc.WorkerServicer): def write_output(self,lxcname,tmplogpath,filepath): 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,""] ret = subprocess.run(cmd % ("/root/nfs/"+tmplogpath,filepath),stdout=subprocess.PIPE,stderr=subprocess.STDOUT, shell=True) 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)) self.add_msg(taskid,username,instanceid,rpc_pb2.TIMEOUT,token,"Running time is out.") 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]) [success2,msg2] = self.write_output(lxcname,jobdir+"/"+stderrname,outpath[1]) if not success1 or not success2: diff --git a/web/templates/batch/batch_create.html b/web/templates/batch/batch_create.html index 4248c30..31945f6 100644 --- a/web/templates/batch/batch_create.html +++ b/web/templates/batch/batch_create.html @@ -132,7 +132,7 @@ task_number += 1; mapping_number = 0; var task_html = ''; - task_html += + task_html += '