Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
ensembl-gh-mirror
ensembl-hive
Commits
be7a995a
Commit
be7a995a
authored
Apr 25, 2016
by
Leo Gordon
Browse files
bugfix: make sure we pause the timer to avoid accumulating running totals
parent
e777a12b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
8 deletions
+11
-8
modules/Bio/EnsEMBL/Hive/Process.pm
modules/Bio/EnsEMBL/Hive/Process.pm
+3
-3
modules/Bio/EnsEMBL/Hive/Utils/Stopwatch.pm
modules/Bio/EnsEMBL/Hive/Utils/Stopwatch.pm
+8
-5
No files found.
modules/Bio/EnsEMBL/Hive/Process.pm
View file @
be7a995a
...
...
@@ -139,18 +139,18 @@ sub life_cycle {
$self
->
enter_status
('
FETCH_INPUT
');
$partial_stopwatch
->
restart
();
$self
->
fetch_input
;
$job_partial_timing
{'
FETCH_INPUT
'}
=
$partial_stopwatch
->
get_elapsed
()
;
$job_partial_timing
{'
FETCH_INPUT
'}
=
$partial_stopwatch
->
pause
->
get_elapsed
;
$self
->
enter_status
('
RUN
');
$partial_stopwatch
->
restart
();
$self
->
run
;
$job_partial_timing
{'
RUN
'}
=
$partial_stopwatch
->
get_elapsed
()
;
$job_partial_timing
{'
RUN
'}
=
$partial_stopwatch
->
pause
->
get_elapsed
;
if
(
$self
->
execute_writes
)
{
$self
->
enter_status
('
WRITE_OUTPUT
');
$partial_stopwatch
->
restart
();
$self
->
write_output
;
$job_partial_timing
{'
WRITE_OUTPUT
'}
=
$partial_stopwatch
->
get_elapsed
()
;
$job_partial_timing
{'
WRITE_OUTPUT
'}
=
$partial_stopwatch
->
pause
->
get_elapsed
;
if
(
$job
->
autoflow
)
{
print
STDERR
"
\n
job
"
.
$job
->
dbID
.
"
: AUTOFLOW input->output
\n
"
if
(
$self
->
debug
);
...
...
modules/Bio/EnsEMBL/Hive/Utils/Stopwatch.pm
View file @
be7a995a
...
...
@@ -63,7 +63,7 @@ sub new {
return
$self
;
}
sub
_unit
{
# only set it once for each timer to avoid messing everything up
sub
_unit
{
# only set it once for each timer to avoid messing everything up
my
$self
=
shift
;
$self
->
{'
_unit
'}
=
shift
if
(
@
_
);
...
...
@@ -84,24 +84,25 @@ sub accumulated {
return
$self
->
{'
_accumulated
'}
||
0
;
}
sub
continue
{
sub
continue
{
# the opposite of pause()
my
$self
=
shift
@_
;
unless
(
$self
->
is_counting
)
{
# ignore if it was already running
$self
->
is_counting
(
1
);
$self
->
{'
_start
'}
=
time
()
*
$self
->
_unit
}
return
$self
;
}
sub
restart
{
my
$self
=
shift
@_
;
$self
->
accumulated
(
0
);
$self
->
continue
;
return
$self
;
return
$self
->
continue
;
}
sub
get_elapsed
{
# peek without stopping (in case it was running)
sub
get_elapsed
{
# peek without stopping (in case it was running)
my
$self
=
shift
@_
;
return
(
$self
->
accumulated
+
$self
->
is_counting
*
(
time
()
*
$self
->
_unit
-
$self
->
{'
_start
'}));
...
...
@@ -112,6 +113,8 @@ sub pause {
$self
->
accumulated
(
$self
->
get_elapsed
);
$self
->
is_counting
(
0
);
return
$self
;
}
1
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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