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
3fcd5f98
Commit
3fcd5f98
authored
May 22, 2012
by
Leo Gordon
Browse files
the Meadow hash is now by type, so no need to iterate to find Meadow-by-Worker
parent
60f1d5e5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
14 deletions
+10
-14
modules/Bio/EnsEMBL/Hive/Valley.pm
modules/Bio/EnsEMBL/Hive/Valley.pm
+10
-14
No files found.
modules/Bio/EnsEMBL/Hive/Valley.pm
View file @
3fcd5f98
...
...
@@ -34,7 +34,7 @@ sub meadow_class_path {
sub
new
{
my
(
$class
,
$current_meadow_
class
)
=
@_
;
my
(
$class
,
$current_meadow_
type
)
=
@_
;
my
$self
=
bless
{},
$class
;
...
...
@@ -44,11 +44,11 @@ sub new {
foreach
my
$meadow_class
(
@
{
find_submodules
(
$self
->
meadow_class_path
)
})
{
eval
"
require
$meadow_class
";
if
(
$meadow_class
->
available
)
{
$amch
->
{
$meadow_class
}
=
$meadow_class
->
new
();
$amch
->
{
$meadow_class
->
type
}
=
$meadow_class
->
new
();
}
}
$self
->
set_current_meadow_
class
(
$current_meadow_
class
);
# run this method even if $current_meadow_
class
was not
given
$self
->
set_current_meadow_
type
(
$current_meadow_
type
);
# run this method even if $current_meadow_
type
was not
specified
return
$self
;
}
...
...
@@ -73,18 +73,14 @@ sub get_available_meadow_list { # this beautiful one-liner pushes $local to
}
sub
set_current_meadow_
class
{
my
(
$self
,
$current_meadow_
class
)
=
@_
;
sub
set_current_meadow_
type
{
my
(
$self
,
$current_meadow_
type
)
=
@_
;
if
(
$current_meadow_class
)
{
unless
(
$current_meadow_class
=~
/::/
)
{
# extend the shorthand into full class name if needed
$current_meadow_class
=
$self
->
meadow_class_path
.
'
::
'
.
uc
(
$current_meadow_class
);
}
if
(
my
$current_meadow
=
$self
->
available_meadow_hash
->
{
$current_meadow_class
}
)
{
# store if available
if
(
$current_meadow_type
)
{
if
(
my
$current_meadow
=
$self
->
available_meadow_hash
->
{
$current_meadow_type
}
)
{
# store if available
$self
->
{
_current_meadow
}
=
$current_meadow
;
}
else
{
die
"
Meadow '
$current_meadow_
class
' does not seem to be available on this machine, please investigate
";
die
"
Meadow '
$current_meadow_
type
' does not seem to be available on this machine, please investigate
";
}
}
else
{
$self
->
{
_current_meadow
}
=
$self
->
get_available_meadow_list
->
[
0
];
# take the first from preference list
...
...
@@ -102,8 +98,8 @@ sub get_current_meadow {
sub
find_available_meadow_responsible_for_worker
{
my
(
$self
,
$worker
)
=
@_
;
foreach
my
$meadow
(
@
{
$self
->
get_
available_meadow_
list
}
)
{
if
(
$meadow
->
responsible_for_worker
(
$worker
)
)
{
if
(
my
$meadow
=
$self
->
available_meadow_
hash
->
{
$worker
->
meadow_type
}
)
{
if
(
$meadow
->
name
eq
$worker
->
meadow_name
)
{
return
$meadow
;
}
}
...
...
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