Commit 0608b2de authored by Pascal Meunier's avatar Pascal Meunier

add Docker support to project mounts

parent c3656af5
......@@ -2241,7 +2241,36 @@ class ContainerDocker(Container):
if 'EXTRA_MOUNT_PATHS' in self.k:
for mnt_pt in self.k['EXTRA_MOUNT_PATHS']:
args += ['-v', mnt_pt[0] + ':' + mnt_pt[1]]
# Mount projects based on user membership
# project path can be different from public project file areas
if "PROJECT_MOUNT" in self.k and self.k["PROJECT_MOUNT"]:
for g in account.group_pairs():
gname = g[0]
gid = g[1]
if gname[0:3] == "pr-":
source_mount = self.k["PROJECT_PATH"] + gname[3:]
if not os.path.exists(source_mount):
continue
args += ['-v', source_mount + ':' + source_mount]
# Mount public project file areas
# can be a different path from user membership-based mounts
if "PROJECT_PUBLIC_MOUNT" in self.k and self.k["PROJECT_PUBLIC_MOUNT"]:
# mount read/write public areas for project members
for g in account.group_pairs():
gname = g[0]
gid = g[1]
if gname[0:3] == "pr-":
source_mount = self.k["PROJECT_PUBLIC_PATH"] + gname[3:] + "/files/public"
if not os.path.exists(source_mount):
continue
args += ['-v', source_mount + ':' + source_mount]
import glob
listing = glob.glob(self.k["PROJECT_PUBLIC_PATH"]+ '/*/files/public')
for pubpath in listing:
if pubpath + ':' + pubpath not in args:
args += ['-v', pubpath + ':' + pubpath + ':ro']
# USER environment variable used for xauth operation
# Can't use the --user option because we need root to setup account and group information
args += ['-e', 'USER='+user]
......@@ -2272,7 +2301,7 @@ class ContainerDocker(Container):
if 'DOCKER_CPU_SHARES' in self.k:
args += ['--cpu-shares', self.k["DOCKER_CPU_SHARES"]]
else:
args += ['--cpu-shares', '8']
args += ['--cpu-shares', '16']
# image must have ENTRYPOINT that updates account and group info from environment variables, then sleeps
# search for image based on name
# expecting command like '/apps/jupyter/r16/middleware/invoke'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment