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
2e01559e
Commit
2e01559e
authored
Apr 09, 2014
by
Leo Gordon
Browse files
switch MetaParameters to the common cache (from a simple hash)
parent
d2e61710
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
26 deletions
+21
-26
modules/Bio/EnsEMBL/Hive/DBSQL/DBAdaptor.pm
modules/Bio/EnsEMBL/Hive/DBSQL/DBAdaptor.pm
+7
-7
modules/Bio/EnsEMBL/Hive/DBSQL/MetaAdaptor.pm
modules/Bio/EnsEMBL/Hive/DBSQL/MetaAdaptor.pm
+1
-16
modules/Bio/EnsEMBL/Hive/MetaParameters.pm
modules/Bio/EnsEMBL/Hive/MetaParameters.pm
+6
-1
modules/Bio/EnsEMBL/Hive/PipeConfig/HiveGeneric_conf.pm
modules/Bio/EnsEMBL/Hive/PipeConfig/HiveGeneric_conf.pm
+7
-2
No files found.
modules/Bio/EnsEMBL/Hive/DBSQL/DBAdaptor.pm
View file @
2e01559e
...
...
@@ -266,12 +266,12 @@ sub AUTOLOAD {
sub
init_collections
{
# should not really belong to DBAdaptor, temporarily squatting here...
foreach
my
$AdaptorType
(
'
MetaParameters
',
'
PipelineWideParameters
')
{
foreach
my
$AdaptorType
('
PipelineWideParameters
')
{
my
$class
=
'
Bio::EnsEMBL::Hive::
'
.
$AdaptorType
;
$class
->
collection
(
{}
);
}
foreach
my
$AdaptorType
('
ResourceClass
',
'
ResourceDescription
',
'
Analysis
',
'
AnalysisStats
',
'
AnalysisCtrlRule
',
'
DataflowRule
')
{
foreach
my
$AdaptorType
(
'
MetaParameters
',
'
ResourceClass
',
'
ResourceDescription
',
'
Analysis
',
'
AnalysisStats
',
'
AnalysisCtrlRule
',
'
DataflowRule
')
{
my
$class
=
'
Bio::EnsEMBL::Hive::
'
.
$AdaptorType
;
$class
->
collection
(
Bio::EnsEMBL::Hive::Utils::
Collection
->
new
()
);
}
...
...
@@ -281,13 +281,13 @@ sub init_collections { # should not really belong to DBAdaptor, temporarily squ
sub
load_collections
{
my
$self
=
shift
@_
;
foreach
my
$AdaptorType
(
'
MetaParameters
',
'
PipelineWideParameters
')
{
foreach
my
$AdaptorType
('
PipelineWideParameters
')
{
my
$adaptor
=
$self
->
get_adaptor
(
$AdaptorType
);
my
$class
=
'
Bio::EnsEMBL::Hive::
'
.
$AdaptorType
;
$class
->
collection
(
$adaptor
->
fetch_param_hash
()
);
}
foreach
my
$AdaptorType
('
ResourceClass
',
'
ResourceDescription
',
'
Analysis
',
'
AnalysisStats
',
'
AnalysisCtrlRule
',
'
DataflowRule
')
{
foreach
my
$AdaptorType
(
'
MetaParameters
',
'
ResourceClass
',
'
ResourceDescription
',
'
Analysis
',
'
AnalysisStats
',
'
AnalysisCtrlRule
',
'
DataflowRule
')
{
my
$adaptor
=
$self
->
get_adaptor
(
$AdaptorType
);
my
$class
=
'
Bio::EnsEMBL::Hive::
'
.
$AdaptorType
;
$class
->
collection
(
Bio::EnsEMBL::Hive::Utils::
Collection
->
new
(
$adaptor
->
fetch_all
)
);
...
...
@@ -298,7 +298,7 @@ sub load_collections {
sub
save_collections
{
my
$self
=
shift
@_
;
foreach
my
$AdaptorType
(
'
MetaParameters
',
'
PipelineWideParameters
')
{
foreach
my
$AdaptorType
('
PipelineWideParameters
')
{
my
$adaptor
=
$self
->
get_adaptor
(
$AdaptorType
);
my
$class
=
'
Bio::EnsEMBL::Hive::
'
.
$AdaptorType
;
while
(
my
(
$hash_key
,
$hash_value
)
=
each
%
{
$class
->
collection
()
}
)
{
...
...
@@ -307,11 +307,11 @@ sub save_collections {
}
}
foreach
my
$AdaptorType
('
ResourceClass
',
'
ResourceDescription
',
'
Analysis
',
'
AnalysisStats
',
'
AnalysisCtrlRule
',
'
DataflowRule
')
{
foreach
my
$AdaptorType
(
'
MetaParameters
',
'
ResourceClass
',
'
ResourceDescription
',
'
Analysis
',
'
AnalysisStats
',
'
AnalysisCtrlRule
',
'
DataflowRule
')
{
my
$adaptor
=
$self
->
get_adaptor
(
$AdaptorType
);
my
$class
=
'
Bio::EnsEMBL::Hive::
'
.
$AdaptorType
;
foreach
my
$storable_object
(
$class
->
collection
()
->
list
)
{
$adaptor
->
store_or_update_one
(
$storable_object
);
$adaptor
->
store_or_update_one
(
$storable_object
,
$class
->
unikey
()
);
# warn "Stored/updated ".$storable_object->toString()."\n";
}
}
...
...
modules/Bio/EnsEMBL/Hive/DBSQL/MetaAdaptor.pm
View file @
2e01559e
...
...
@@ -45,27 +45,12 @@ sub default_table_name {
}
sub
replace_pair
{
my
(
$self
,
$meta_key
,
$meta_value
)
=
@_
;
$self
->
remove_all_by_meta_key
(
$meta_key
);
# make sure the previous values are gone
return
$self
->
store
(
{
'
meta_key
'
=>
$meta_key
,
'
meta_value
'
=>
$meta_value
}
);
}
sub
fetch_param_hash
{
my
$self
=
shift
@_
;
return
$self
->
fetch_HASHED_FROM_meta_key_TO_meta_value
();
}
sub
get_value_by_key
{
my
(
$self
,
$meta_key
)
=
@_
;
if
(
my
$collection
=
Bio::EnsEMBL::Hive::
MetaParameters
->
collection
()
)
{
return
$collection
->
{
$meta_key
}
;
return
$collection
->
find_one_by
(
'
meta_key
',
$meta_key
)
;
}
else
{
...
...
modules/Bio/EnsEMBL/Hive/MetaParameters.pm
View file @
2e01559e
...
...
@@ -33,6 +33,11 @@ package Bio::EnsEMBL::Hive::MetaParameters;
use
strict
;
use
base
(
'
Bio::EnsEMBL::Hive::Cacheable
'
);
sub
unikey
{
# override the default from Cacheable parent
return
[
'
meta_key
'
];
}
1
;
modules/Bio/EnsEMBL/Hive/PipeConfig/HiveGeneric_conf.pm
View file @
2e01559e
...
...
@@ -455,8 +455,13 @@ sub add_objects_from_config {
my
$self
=
shift
@_
;
warn
"
Adding hive_meta table entries ...
\n
";
my
$hm_coll
=
Bio::EnsEMBL::Hive::
MetaParameters
->
collection
();
%$hm_coll
=
(
%$hm_coll
,
%
{
$self
->
hive_meta_table
()}
);
my
$new_meta_entries
=
$self
->
hive_meta_table
();
while
(
my
(
$meta_key
,
$meta_value
)
=
each
%$new_meta_entries
)
{
Bio::EnsEMBL::Hive::
MetaParameters
->
add_new_or_update
(
'
meta_key
'
=>
$meta_key
,
'
meta_value
'
=>
$meta_value
,
);
}
warn
"
Done.
\n\n
";
warn
"
Adding pipeline-wide parameters ...
\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