Skip to content

Commit

Permalink
Mount command .sh
Browse files Browse the repository at this point in the history
Signed-off-by: Diego Ciangottini <[email protected]>
  • Loading branch information
dciangot committed Jul 5, 2024
1 parent 0de4696 commit 43fcc1f
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions pkg/slurm/aux.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,10 +290,10 @@ func prepareMounts(

}

mountedData += "--bind " + config.DataRootFolder + podData.Pod.Namespace + "-" + string(podData.Pod.UID) + "/" + "command_" + container.Name + ".sh" +
":" + "/tmp/" + "command_" + container.Name + ".sh "
mountedData += "--bind " + config.DataRootFolder + podData.Pod.Namespace + "-" + string(podData.Pod.UID) + "/" + "args_" + container.Name + ".sh" +
":" + "/tmp/" + "args_" + container.Name + ".sh"
mountedData += "--bind " + config.DataRootFolder + podData.Pod.Namespace + "-" + string(podData.Pod.UID) + "/" + "command_" + container.Name + ".sh" +
":" + "/tmp/" + "command_" + container.Name + ".sh "
mountedData += "--bind " + config.DataRootFolder + podData.Pod.Namespace + "-" + string(podData.Pod.UID) + "/" + "args_" + container.Name + ".sh" +
":" + "/tmp/" + "args_" + container.Name + ".sh"

if last := len(mountedData) - 1; last >= 0 && mountedData[last] == ',' {
mountedData = mountedData[:last]
Expand Down Expand Up @@ -432,7 +432,11 @@ func produceSLURMScript(
defer f2.Close()

if len(singularityCommand.containerArgs) != 0 {
cmdString = strings.Join(singularityCommand.containerCommand, " ") + " \"$(cat /tmp/args_" + singularityCommand.containerName + ".sh)\""
if singularityCommand.containerCommand != nil {
cmdString = strings.Join(singularityCommand.containerCommand, " ") + " \"$(cat /tmp/args_" + singularityCommand.containerName + ".sh)\""
} else {
cmdString = "/bin/sh -c \"$(cat /tmp/args_" + singularityCommand.containerName + ".sh)\""
}
} else {
cmdString = strings.Join(singularityCommand.containerCommand, " ")
}
Expand Down

0 comments on commit 43fcc1f

Please sign in to comment.