Skip to content

Commit

Permalink
Adds volume spec for output volume, but doesn't work
Browse files Browse the repository at this point in the history
I don't think the command is running properly
  • Loading branch information
dleehr committed Dec 19, 2018
1 parent 1faa4d2 commit e6a43a6
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions seawall/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ def container_volume_mounts(self):
'name': '{}-vol-{}'.format(self.name, index),
'mountPath': volume[1]
})

# Also need an output volume
mounts.append({
'name': '{}-vol-outdir'.format(self.name),
'mountPath': self.seawall_job.builder.outdir
})
return mounts

def volumes(self):
Expand All @@ -92,11 +98,19 @@ def volumes(self):
# Leaving off type here since we won't be using hostPath long-term
}
})
# And also add the outdir
volumes.append({
'name': '{}-vol-outdir'.format(self.name),
'hostPath': {
'path': self.seawall_job.outdir
}
})
return volumes

def container_command(self):
# TODO: Check shellquote or shell command requirement
# TODO: stdout/in/err may point to directory paths that don't exist, so add a container beforehand with a simple script that creates those
# TODO: stdout/in/err may point to directory paths that don't exist yet
# so add a container beforehand with a simple script that creates those
# I think a k8s job can have multiple containers in sequence.
command = []
command.extend(self.seawall_job.command_line)
Expand All @@ -106,10 +120,8 @@ def container_command(self):
command.extend(['2>', self.seawall_job.stderr])
if self.seawall_job.stdin:
command.extend(['<', self.seawall_job.stdin])
import pipes
import shellescape
command = [shellescape.quote(x) for x in command]

return ['/bin/sh', '-c'] + command

def container_environment(self):
Expand Down Expand Up @@ -232,6 +244,8 @@ def populate_volumes(self):
# This is the case where the file contents are literal in the job order
# So this code can simply write that out to temporary space in the filesystem
# but it doesn't make it into self.volumes list
# Looks like the underlying assumption is that we can just write that out locally from the engine
# and it goes to the directory that will be the working dir for the container
if host_outdir_tgt:
with open(host_outdir_tgt, "wb") as f:
f.write(vol.resolved.encode("utf-8"))
Expand Down

0 comments on commit e6a43a6

Please sign in to comment.