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
513dfa4e
Commit
513dfa4e
authored
Apr 10, 2014
by
Leo Gordon
Browse files
switch PipelineWideParameters to the common cache (from a simple hash)
parent
2e01559e
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
27 additions
and
38 deletions
+27
-38
modules/Bio/EnsEMBL/Hive/DBSQL/DBAdaptor.pm
modules/Bio/EnsEMBL/Hive/DBSQL/DBAdaptor.pm
+3
-23
modules/Bio/EnsEMBL/Hive/DBSQL/MetaAdaptor.pm
modules/Bio/EnsEMBL/Hive/DBSQL/MetaAdaptor.pm
+1
-1
modules/Bio/EnsEMBL/Hive/DBSQL/PipelineWideParametersAdaptor.pm
...s/Bio/EnsEMBL/Hive/DBSQL/PipelineWideParametersAdaptor.pm
+11
-12
modules/Bio/EnsEMBL/Hive/PipeConfig/HiveGeneric_conf.pm
modules/Bio/EnsEMBL/Hive/PipeConfig/HiveGeneric_conf.pm
+7
-2
modules/Bio/EnsEMBL/Hive/PipelineWideParameters.pm
modules/Bio/EnsEMBL/Hive/PipelineWideParameters.pm
+5
-0
No files found.
modules/Bio/EnsEMBL/Hive/DBSQL/DBAdaptor.pm
View file @
513dfa4e
...
...
@@ -266,12 +266,7 @@ sub AUTOLOAD {
sub
init_collections
{
# should not really belong to DBAdaptor, temporarily squatting here...
foreach
my
$AdaptorType
('
PipelineWideParameters
')
{
my
$class
=
'
Bio::EnsEMBL::Hive::
'
.
$AdaptorType
;
$class
->
collection
(
{}
);
}
foreach
my
$AdaptorType
('
MetaParameters
',
'
ResourceClass
',
'
ResourceDescription
',
'
Analysis
',
'
AnalysisStats
',
'
AnalysisCtrlRule
',
'
DataflowRule
')
{
foreach
my
$AdaptorType
('
MetaParameters
',
'
PipelineWideParameters
',
'
ResourceClass
',
'
ResourceDescription
',
'
Analysis
',
'
AnalysisStats
',
'
AnalysisCtrlRule
',
'
DataflowRule
')
{
my
$class
=
'
Bio::EnsEMBL::Hive::
'
.
$AdaptorType
;
$class
->
collection
(
Bio::EnsEMBL::Hive::Utils::
Collection
->
new
()
);
}
...
...
@@ -281,13 +276,7 @@ sub init_collections { # should not really belong to DBAdaptor, temporarily squ
sub
load_collections
{
my
$self
=
shift
@_
;
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
('
MetaParameters
',
'
ResourceClass
',
'
ResourceDescription
',
'
Analysis
',
'
AnalysisStats
',
'
AnalysisCtrlRule
',
'
DataflowRule
')
{
foreach
my
$AdaptorType
('
MetaParameters
',
'
PipelineWideParameters
',
'
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,16 +287,7 @@ sub load_collections {
sub
save_collections
{
my
$self
=
shift
@_
;
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
()
}
)
{
$adaptor
->
replace_pair
(
$hash_key
,
$hash_value
);
# warn "Stored/updated '$hash_key' => '$hash_value'\n";
}
}
foreach
my
$AdaptorType
('
MetaParameters
',
'
ResourceClass
',
'
ResourceDescription
',
'
Analysis
',
'
AnalysisStats
',
'
AnalysisCtrlRule
',
'
DataflowRule
')
{
foreach
my
$AdaptorType
('
MetaParameters
',
'
PipelineWideParameters
',
'
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
)
{
...
...
modules/Bio/EnsEMBL/Hive/DBSQL/MetaAdaptor.pm
View file @
513dfa4e
...
...
@@ -52,7 +52,7 @@ sub get_value_by_key {
return
$collection
->
find_one_by
(
'
meta_key
',
$meta_key
);
}
else
{
}
else
{
# TODO: to be removed when beekeeper.pl/runWorker.pl become collection-aware
my
$pair
=
$self
->
fetch_by_meta_key
(
$meta_key
);
return
$pair
&&
$pair
->
{'
meta_value
'};
...
...
modules/Bio/EnsEMBL/Hive/DBSQL/PipelineWideParametersAdaptor.pm
View file @
513dfa4e
...
...
@@ -45,27 +45,26 @@ sub default_table_name {
}
sub
replace_pair
{
my
(
$self
,
$param_name
,
$param_value
)
=
@_
;
$self
->
remove_all_by_param_name
(
$param_name
);
# make sure the previous values are gone
return
$self
->
store
(
{
'
param_name
'
=>
$param_name
,
'
param_value
'
=>
stringify
(
$param_value
)
}
);
}
=head2 fetch_param_hash
Description: returns the content of the '
meta
' table as a hash
Description: returns the content
s
of the '
pipeline_wide_parameters
' table as a hash
=cut
sub
fetch_param_hash
{
my
$self
=
shift
@_
;
my
$original_value
=
$self
->
fetch_HASHED_FROM_param_name_TO_param_value
();
my
%destringified_hash
=
map
{
$_
,
destringify
(
$original_value
->
{
$_
})
}
keys
%$original_value
;
if
(
my
$collection
=
Bio::EnsEMBL::Hive::
PipelineWideParameters
->
collection
()
)
{
return
{
map
{
$_
->
{'
param_name
'}
=>
destringify
(
$-
>
{'
param_value
'})
}
$collection
->
list
()
};
}
else
{
# TODO: to be removed when beekeeper.pl/runWorker.pl become collection-aware
my
$original_value
=
$self
->
fetch_HASHED_FROM_param_name_TO_param_value
();
my
%destringified_hash
=
map
{
$_
,
destringify
(
$original_value
->
{
$_
})
}
keys
%$original_value
;
return
\
%destringified_hash
;
return
\
%destringified_hash
;
}
}
1
;
modules/Bio/EnsEMBL/Hive/PipeConfig/HiveGeneric_conf.pm
View file @
513dfa4e
...
...
@@ -465,8 +465,13 @@ sub add_objects_from_config {
warn
"
Done.
\n\n
";
warn
"
Adding pipeline-wide parameters ...
\n
";
my
$mc_coll
=
Bio::EnsEMBL::Hive::
PipelineWideParameters
->
collection
();
%$mc_coll
=
(
%$mc_coll
,
%
{
$self
->
pipeline_wide_parameters
()}
);
my
$new_pwp_entries
=
$self
->
pipeline_wide_parameters
();
while
(
my
(
$param_name
,
$param_value
)
=
each
%$new_pwp_entries
)
{
Bio::EnsEMBL::Hive::
PipelineWideParameters
->
add_new_or_update
(
'
param_name
'
=>
$param_name
,
'
param_value
'
=>
$param_value
,
);
}
warn
"
Done.
\n\n
";
warn
"
Adding Resources ...
\n
";
...
...
modules/Bio/EnsEMBL/Hive/PipelineWideParameters.pm
View file @
513dfa4e
...
...
@@ -34,5 +34,10 @@ use strict;
use
base
(
'
Bio::EnsEMBL::Hive::Cacheable
'
);
sub
unikey
{
# override the default from Cacheable parent
return
[
'
param_name
'
];
}
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