Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
ensembl-hive
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
7
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ensembl-gh-mirror
ensembl-hive
Commits
0b75aa0d
Commit
0b75aa0d
authored
10 years ago
by
Leo Gordon
Browse files
Options
Downloads
Patches
Plain Diff
recover completion datetime from bacct output (guess the year based on day-of-the-week hint)
parent
94ef7f09
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/Bio/EnsEMBL/Hive/Meadow/LSF.pm
+25
-8
25 additions, 8 deletions
modules/Bio/EnsEMBL/Hive/Meadow/LSF.pm
with
25 additions
and
8 deletions
modules/Bio/EnsEMBL/Hive/Meadow/LSF.pm
+
25
−
8
View file @
0b75aa0d
...
...
@@ -31,6 +31,7 @@
package
Bio::EnsEMBL::Hive::Meadow::
LSF
;
use
strict
;
use
Time::
Piece
;
use
base
('
Bio::EnsEMBL::Hive::Meadow
');
...
...
@@ -153,6 +154,22 @@ sub kill_worker {
}
sub
_yearless_2_datetime
{
# a private subroutine that recovers missing year from a date and transforms it into SQL's datetime for storage
my
$wd_yearless
=
shift
@_
;
my
(
$wd
,
$yearless
)
=
split
('
',
$wd_yearless
,
2
);
my
$curr_year
=
Time::
Piece
->
new
->
year
();
foreach
my
$year
(
$curr_year
,
$curr_year
-
1
)
{
my
$datetime
=
Time::
Piece
->
strptime
("
$yearless
$year
",
'
%b %d %T %Y
');
if
(
$datetime
->
wdayname
eq
$wd
)
{
return
$datetime
->
date
.
'
'
.
$datetime
->
hms
;
}
}
return
;
# could not guess the year
}
sub
parse_report_source_line
{
my
$bacct_source_line
=
shift
@_
;
...
...
@@ -184,11 +201,11 @@ sub parse_report_source_line {
if
(
my
(
$process_id
)
=
$lines
[
0
]
=~
/^Job <(\d+(?:\[\d+\])?)>/
)
{
my
(
$exit_status
,
$exception_status
)
=
(''
x
2
);
my
(
$completion_datetime
,
$c
od
);
my
(
$completion_datetime
,
$c
ause_of_death
);
foreach
(
@lines
)
{
if
(
/^(\w+\s+\w+\s+\d+\s+\d+:\d+:\d+):\s+Completed\s<(\w+)>(?:\.|;\s+(\w+))/
)
{
$completion_datetime
=
$
1
;
$c
od
=
$status_2_cod
{
$
3
};
$completion_datetime
=
_yearless_2_datetime
(
$
1
)
;
$c
ause_of_death
=
$status_2_cod
{
$
3
};
$exit_status
=
$
2
.
(
$
3
?
"
/$3
"
:
'');
}
elsif
(
/^\s*EXCEPTION STATUS:\s*(.*?)\s*$/
)
{
...
...
@@ -208,7 +225,7 @@ sub parse_report_source_line {
$report_entry
{
$process_id
}
=
{
'
completion_datetime
'
=>
$completion_datetime
,
'
c
od
'
=>
$cod
,
'
c
ause_of_death
'
=>
$cause_of_death
,
'
exit_status
'
=>
$exit_status
,
'
exception_status
'
=>
$exception_status
,
'
mem_megs
'
=>
$mem_in_units
*
$units_2_megs
{
$mem_unit
},
...
...
@@ -228,7 +245,7 @@ sub parse_report_source_line {
sub
find_out_causes
{
my
$self
=
shift
@_
;
my
%c
od
=
();
my
%c
auses_of_death
=
();
while
(
my
$pid_batch
=
join
('
',
map
{
"
'
$_
'
"
}
splice
(
@
_
,
0
,
20
)))
{
# can't fit too many pids on one shell cmdline
my
$cmd
=
"
bacct -l
$pid_batch
|
";
...
...
@@ -238,13 +255,13 @@ sub find_out_causes {
my
$report_entries
=
parse_report_source_line
(
$cmd
);
while
(
my
(
$process_id
,
$report_entry
)
=
each
%$report_entries
)
{
if
(
my
$
entry_cod
=
$report_entry
->
{'
c
od
'})
{
$c
od
{
$process_id
}
=
$
entry_cod
;
if
(
my
$
cause_of_death
=
$report_entry
->
{'
c
ause_of_death
'})
{
$c
auses_of_death
{
$process_id
}
=
$
cause_of_death
;
}
}
}
return
\
%c
od
;
return
\
%c
auses_of_death
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
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!
Save comment
Cancel
Please
register
or
sign in
to comment