15 Global cache
for HivePipeline objects.
19 Copyright [1999-2015] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute
20 Copyright [2016-2022] EMBL-European Bioinformatics Institute
22 Licensed under the Apache License,
Version 2.0 (the
"License"); you may not use
this file except in compliance with the License.
23 You may obtain a copy of the License at
27 Unless required by applicable law or agreed to in writing, software distributed under the License
28 is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
29 See the License
for the specific language governing permissions and limitations under the License.
33 Please subscribe to the
Hive mailing list: http:
38 package Bio::EnsEMBL::Hive::TheApiary;
49 # global instance to cache HivePipeline objects: 50 my $_global_Apiary_collection;
53 sub pipelines_collection {
56 return $_global_Apiary_collection ||= Bio::EnsEMBL::Hive::Utils::Collection->
new;
60 sub pipelines_except {
61 my ($class, $except_pipeline) = @_;
63 my $except_unambig_key = $except_pipeline->unambig_key;
65 return [ grep { $_->unambig_key ne $except_unambig_key } $class->pipelines_collection->list ];
72 my $default_pipeline = shift @_;
73 my $no_die = shift @_;
78 my $query_params = $parsed_url->{
'query_params'};
79 my $conn_params = $parsed_url->{
'conn_params'};
81 my $disconnect_when_inactive = $conn_params->{
'disconnect_when_inactive'};
82 my $no_sql_schema_version_check = $conn_params->{
'no_sql_schema_version_check'};
86 if($unambig_key eq
':///') {
88 $hive_pipeline = $default_pipeline;
90 } elsif( not ($hive_pipeline = $class->pipelines_collection->find_one_by(
'unambig_key', $unambig_key ) ) ) {
92 if($query_params and ($query_params->{
'object_type'} eq
'NakedTable') ) { #
do not check schema version when performing table dataflow:
93 $no_sql_schema_version_check = 1;
97 -url => $parsed_url->{
'dbconn_part'},
98 -disconnect_when_inactive => $disconnect_when_inactive,
99 -no_sql_schema_version_check=> $no_sql_schema_version_check,
104 ? $hive_pipeline->find_by_query( $query_params, $no_die )
108 die
"Could not parse '$url' as URL";
113 sub fetch_remote_semaphores_controlling_this_one { # NB! This method has a (potentially unwanted) side-effect of adding @extra_pipelines to
TheApiary. Use with caution.
114 my ($class, $this_semaphore_or_url, @extra_pipelines) = @_;
116 my $this_semaphore_url = ref($this_semaphore_or_url)
117 ? $this_semaphore_or_url->relative_url( 0 ) # turn a semaphore into its global URL
118 : $this_semaphore_or_url; # just use the provided URL
120 my @remote_controlling_semaphores = ();
122 foreach my $remote_pipeline ($class->pipelines_collection->list, @extra_pipelines ) {
124 push @remote_controlling_semaphores, @{ $remote_pipeline->hive_dba->get_SemaphoreAdaptor->fetch_all_by_dependent_semaphore_url( $this_semaphore_url ) };
127 return \@remote_controlling_semaphores;
public A hash_to_unambig_url()