Merge pull request #326 from FirmlyReality/batch

add token to lxcname
This commit is contained in:
Yujian Zhu 2018-08-08 21:34:30 +08:00 committed by GitHub
commit e2a069dc08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -122,14 +122,14 @@ class TaskController(rpc_pb2_grpc.WorkerServicer):
image['type'] = 'base'
image['owner'] = request.cluster.image.owner
username = request.username
lxcname = '%s-batch-%s-%s' % (username,taskid,str(instanceid))
token = request.token
lxcname = '%s-batch-%s-%s-%s' % (username,taskid,str(instanceid),token)
instance_type = request.cluster.instance
outpath = [request.parameters.stdoutRedirectPath,request.parameters.stderrRedirectPath]
for i in range(len(outpath)):
if outpath[i] == "":
outpath[i] = "/root/nfs/"
timeout = request.timeout
token = request.token
# acquire ip
[status, ip] = self.acquire_ip()
@ -146,7 +146,7 @@ class TaskController(rpc_pb2_grpc.WorkerServicer):
if not os.path.isdir("%s/global/users/%s" % (self.fspath,username)):
path = env.getenv('DOCKLET_LIB')
subprocess.call([path+"/userinit.sh", username])
subprocess.call([path+"/master/userinit.sh", username])
logger.info("user %s directory not found, create it" % username)
sys_run("mkdir -p /var/lib/lxc/%s" % lxcname)
logger.info("generate config file for %s" % lxcname)