Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ensembl-gh-mirror
ensembl-hive
Commits
9718aeda
Commit
9718aeda
authored
Apr 29, 2014
by
Leo Gordon
Browse files
it may be expensive to acquire the meadow_name, so try to do it only once and cache afterwards
parent
73f1512d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
9 deletions
+25
-9
modules/Bio/EnsEMBL/Hive/Meadow.pm
modules/Bio/EnsEMBL/Hive/Meadow.pm
+19
-3
modules/Bio/EnsEMBL/Hive/Valley.pm
modules/Bio/EnsEMBL/Hive/Valley.pm
+3
-3
scripts/load_resource_usage.pl
scripts/load_resource_usage.pl
+3
-3
No files found.
modules/Bio/EnsEMBL/Hive/Meadow.pm
View file @
9718aeda
...
...
@@ -44,12 +44,28 @@ sub new {
my
$self
=
bless
{},
$class
;
$self
->
config
(
$config
);
$self
->
context
(
[
'
Meadow
',
$self
->
type
,
$self
->
name
]
);
$self
->
context
(
[
'
Meadow
',
$self
->
type
,
$self
->
cached_
name
]
);
return
$self
;
}
sub
cached_name
{
my
(
$self
)
=
@_
;
my
$name
;
unless
(
ref
(
$self
)
and
$name
=
$self
->
{'
_name
'}
)
{
if
(
$name
=
$self
->
name
()
and
ref
(
$self
)
)
{
$self
->
{'
_name
'}
=
$name
;
}
}
return
$name
;
}
sub
type
{
# should return 'LOCAL' or 'LSF'
my
$class
=
shift
@_
;
...
...
@@ -62,7 +78,7 @@ sub type { # should return 'LOCAL' or 'LSF'
sub
signature
{
my
$self
=
shift
@_
;
return
$self
->
type
.
'
/
'
.
$self
->
name
;
return
$self
->
type
.
'
/
'
.
$self
->
cached_
name
;
}
...
...
@@ -95,7 +111,7 @@ sub generate_job_name {
sub
responsible_for_worker
{
my
(
$self
,
$worker
)
=
@_
;
return
(
$worker
->
meadow_type
eq
$self
->
type
)
&&
(
$worker
->
meadow_name
eq
$self
->
name
);
return
(
$worker
->
meadow_type
eq
$self
->
type
)
&&
(
$worker
->
meadow_name
eq
$self
->
cached_
name
);
}
...
...
modules/Bio/EnsEMBL/Hive/Valley.pm
View file @
9718aeda
...
...
@@ -61,7 +61,7 @@ sub new {
# make sure modules are loaded and available ones are checked prior to setting the current one
foreach
my
$meadow_class
(
@
{
find_submodules
(
$self
->
meadow_class_path
)
})
{
eval
"
require
$meadow_class
";
if
(
$meadow_class
->
name
)
{
if
(
$meadow_class
->
name
)
{
my
$meadow_object
=
$meadow_class
->
new
(
$config
);
$meadow_object
->
pipeline_name
(
$pipeline_name
)
if
(
$pipeline_name
);
...
...
@@ -121,7 +121,7 @@ sub find_available_meadow_responsible_for_worker {
my
(
$self
,
$worker
)
=
@_
;
if
(
my
$meadow
=
$self
->
available_meadow_hash
->
{
$worker
->
meadow_type
}
)
{
if
(
$meadow
->
name
eq
$worker
->
meadow_name
)
{
if
(
$meadow
->
cached_
name
eq
$worker
->
meadow_name
)
{
return
$meadow
;
}
}
...
...
@@ -137,7 +137,7 @@ sub whereami {
eval
{
$pid
=
$meadow
->
get_current_worker_process_id
();
$meadow_type
=
$meadow
->
type
();
$meadow_name
=
$meadow
->
name
();
$meadow_name
=
$meadow
->
cached_
name
();
};
unless
(
$@
)
{
last
;
...
...
scripts/load_resource_usage.pl
View file @
9718aeda
...
...
@@ -65,7 +65,7 @@ sub main {
warn
"
Taking the resource_usage data from the source (
$source_line
), assuming Meadow
"
.
$meadow
->
signature
.
"
\n
";
if
(
my
$report_entries
=
$meadow
->
parse_report_source_line
(
$source_line
)
)
{
$queen
->
store_resource_usage
(
$report_entries
,
$meadow_2_pid_wid
->
{
$meadow
->
type
}{
$meadow
->
name
}
);
$queen
->
store_resource_usage
(
$report_entries
,
$meadow_2_pid_wid
->
{
$meadow
->
type
}{
$meadow
->
cached_
name
}
);
}
}
else
{
...
...
@@ -77,9 +77,9 @@ sub main {
warn
"
\n
Finding out the time interval when the pipeline was run on Meadow
"
.
$meadow
->
signature
.
"
\n
";
if
(
my
$our_interval
=
$meadow_2_interval
->
{
$meadow
->
type
}{
$meadow
->
name
}
)
{
if
(
my
$our_interval
=
$meadow_2_interval
->
{
$meadow
->
type
}{
$meadow
->
cached_
name
}
)
{
if
(
my
$report_entries
=
$meadow
->
get_report_entries_for_time_interval
(
$our_interval
->
{'
min_born
'},
$our_interval
->
{'
max_died
'},
$username
)
)
{
$queen
->
store_resource_usage
(
$report_entries
,
$meadow_2_pid_wid
->
{
$meadow
->
type
}{
$meadow
->
name
}
);
$queen
->
store_resource_usage
(
$report_entries
,
$meadow_2_pid_wid
->
{
$meadow
->
type
}{
$meadow
->
cached_
name
}
);
}
}
else
{
warn
"
\t
Nothing new to store for Meadow
"
.
$meadow
->
signature
.
"
\n
";
...
...
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