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
d609b6cb
Commit
d609b6cb
authored
Nov 26, 2016
by
Peter van 't Hof
Browse files
Added compress method
parent
00e96408
Changes
2
Hide whitespace changes
Inline
Side-by-side
biopet-core/src/main/scala/nl/lumc/sasc/biopet/core/BiopetQScript.scala
View file @
d609b6cb
...
...
@@ -121,7 +121,10 @@ trait BiopetQScript extends Configurable with GatkLogging { qscript: QScript =>
}
})
WriteDependencies
.
writeDependencies
(
functions
,
new
File
(
outputDir
,
s
".log/${qSettings.runName}.deps.json"
))
WriteDependencies
.
writeDependencies
(
functions
,
new
File
(
outputDir
,
s
".log/${qSettings.runName}.deps.json"
),
Some
(
new
File
(
outputDir
,
s
".log/${qSettings.runName}.mainJobs.json"
))
)
Logging
.
checkErrors
()
logger
.
info
(
"Script complete without errors"
)
...
...
biopet-core/src/main/scala/nl/lumc/sasc/biopet/core/WriteDependencies.scala
View file @
d609b6cb
...
...
@@ -49,7 +49,7 @@ object WriteDependencies extends Logging with Configurable {
* @param functions This should be all functions that are given to the graph of Queue
* @param outputFile Json file to write dependencies to
*/
def
writeDependencies
(
functions
:
Seq
[
QFunction
],
outputFile
:
File
)
:
Unit
=
{
def
writeDependencies
(
functions
:
Seq
[
QFunction
],
outputFile
:
File
,
mainJobsFile
:
Option
[
File
]
=
None
)
:
Unit
=
{
logger
.
info
(
"Start calculating dependencies"
)
val
errorOnMissingInput
:
Boolean
=
config
(
"error_on_missing_input"
,
false
)
...
...
@@ -126,14 +126,37 @@ object WriteDependencies extends Logging with Configurable {
"fail_at_start"
->
f
.
isFail
)
}.
toIterator
.
toMap
mainJobsFile
.
foreach
{
file
=>
val
mainJobs
=
jobs
.
filter
(
_
.
_2
(
"main_job"
)
==
true
).
map
{
case
(
name
,
job
)
=>
name
->
(
job
+
(
"depends_on_jobs"
->
getMainDependencies
(
name
,
jobs
)))
}
val
writer
=
new
PrintWriter
(
file
)
writer
.
println
(
ConfigUtils
.
mapToJson
(
mainJobs
).
spaces2
)
writer
.
close
()
}
logger
.
info
(
s
"Writing dependencies to: $outputFile"
)
val
writer
=
new
PrintWriter
(
outputFile
)
writer
.
println
(
ConfigUtils
.
mapToJson
(
Map
(
"jobs"
->
jobs
.
toMap
,
"jobs"
->
jobs
,
"files"
->
files
.
values
.
par
.
map
(
_
.
getMap
).
toList
)).
spaces2
)
writer
.
close
()
logger
.
info
(
"done calculating dependencies"
)
}
def
getMainDependencies
(
jobName
:
String
,
jobsMap
:
Map
[
String
,
Map
[
String
,
Any
]])
:
List
[
String
]
=
{
val
job
=
jobsMap
(
jobName
)
val
dependencies
=
job
(
"depends_on_jobs"
)
match
{
case
l
:
List
[
_
]
=>
l
.
map
(
_
.
toString
)
}
dependencies
.
flatMap
{
dep
=>
jobsMap
(
dep
)(
"main_job"
)
match
{
case
true
=>
List
(
dep
)
case
false
=>
getMainDependencies
(
dep
,
jobsMap
)
}
}
}
}
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