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
351508ec
Commit
351508ec
authored
Jul 28, 2016
by
Peter van 't Hof
Browse files
Changed to Future.sequence
parent
50bb1535
Changes
1
Hide whitespace changes
Inline
Side-by-side
biopet-tools/src/main/scala/nl/lumc/sasc/biopet/tools/bamstats/BamStats.scala
View file @
351508ec
...
...
@@ -127,19 +127,7 @@ object BamStats extends ToolCommand {
def
waitOnFutures
(
futures
:
List
[
Future
[
Stats
]],
msg
:
Option
[
String
]
=
None
)
:
Stats
=
{
msg
.
foreach
(
m
=>
logger
.
info
(
s
"Start monitoring jobs for '$m', ${futures.size} jobs"
))
futures
.
foreach
(
_
.
onFailure
{
case
t
=>
throw
new
RuntimeException
(
t
)
})
var
stats
=
Stats
()
var
running
=
futures
while
(
running
.
nonEmpty
)
{
val
done
=
running
.
filter
(
_
.
value
.
isDefined
)
done
.
foreach
(
stats
+=
_
.
value
.
get
.
get
)
running
=
running
.
filterNot
(
done
.
contains
(
_
))
if
(
running
.
nonEmpty
&&
done
.
nonEmpty
)
msg
.
foreach
(
m
=>
logger
.
info
(
s
"Jobs for '$m', ${running.size}/${futures.size} jobs"
))
if
(
running
.
nonEmpty
)
try
{
Await
.
ready
(
running
.
head
,
1
second
)
}
catch
{
case
e
:
TimeoutException
=>
}
}
val
stats
=
Await
.
result
(
Future
.
sequence
(
futures
).
map
(
_
.
fold
(
Stats
())(
_
+=
_
)),
Duration
.
Inf
)
msg
.
foreach
(
m
=>
logger
.
info
(
s
"All jobs for '$m' are done"
))
stats
}
...
...
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