Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Mirrors
biopet.biopet
Commits
9230f543
Commit
9230f543
authored
Sep 29, 2015
by
Peter van 't Hof
Browse files
Added set limits to bash script
parent
910074b8
Changes
1
Hide whitespace changes
Inline
Side-by-side
public/biopet-core/src/main/scala/nl/lumc/sasc/biopet/core/BiopetCommandLineFunction.scala
View file @
9230f543
...
...
@@ -15,7 +15,7 @@
*/
package
nl.lumc.sasc.biopet.core
import
java.io.
{
File
,
FileInputStream
}
import
java.io.
{
PrintWriter
,
File
,
FileInputStream
}
import
java.security.MessageDigest
import
nl.lumc.sasc.biopet.utils.Logging
...
...
@@ -26,8 +26,10 @@ import org.broadinstitute.gatk.utils.runtime.ProcessSettings
import
org.ggf.drmaa.JobTemplate
import
scala.collection.mutable
import
scala.io.Source
import
scala.sys.process.
{
Process
,
ProcessLogger
}
import
scala.util.matching.Regex
import
scala.collection.JavaConversions._
/** Biopet command line trait to auto check executable and cluster values */
trait
BiopetCommandLineFunction
extends
CommandLineFunction
with
Configurable
{
biopetFunction
=>
...
...
@@ -58,10 +60,25 @@ trait BiopetCommandLineFunction extends CommandLineFunction with Configurable {
def
defaultRemoteCommand
=
"bash"
private
val
remoteCommand
:
String
=
config
(
"remote_command"
,
default
=
defaultRemoteCommand
)
private
def
changeScript
(
file
:
File
)
:
Unit
=
{
val
lines
=
Source
.
fromFile
(
file
).
getLines
().
toList
val
writer
=
new
PrintWriter
(
file
)
writer
.
println
(
"set -eubf"
)
writer
.
println
(
"set -o pipefail"
)
lines
.
foreach
(
writer
.
println
(
_
))
writer
.
close
()
}
// This overrides the default "sh" from queue. For Biopet the default is "bash"
updateJobRun
=
{
case
jt
:
JobTemplate
=>
jt
.
setRemoteCommand
(
remoteCommand
)
case
ps
:
ProcessSettings
=>
ps
.
setCommand
(
Array
(
remoteCommand
)
++
ps
.
getCommand
.
tail
)
case
jt
:
JobTemplate
=>
{
changeScript
(
new
File
(
jt
.
getArgs
.
head
.
toString
))
jt
.
setRemoteCommand
(
remoteCommand
)
}
case
ps
:
ProcessSettings
=>
{
changeScript
(
new
File
(
ps
.
getCommand
.
tail
.
head
))
ps
.
setCommand
(
Array
(
remoteCommand
)
++
ps
.
getCommand
.
tail
)
}
}
/**
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment