ensembl-hive  2.8.1
refresh_guest_languages.pl
Go to the documentation of this file.
1 #!/usr/bin/env perl
2 use strict;
3 use warnings;
4 
5  # Finding out own path in order to reference own components (including own modules):
6 use Cwd ();
7 use File::Basename ();
8 BEGIN {
9  $ENV{'EHIVE_ROOT_DIR'} ||= File::Basename::dirname( File::Basename::dirname( Cwd::realpath($0) ) );
10  unshift @INC, $ENV{'EHIVE_ROOT_DIR'}.'/modules';
11 }
12 
13 use Getopt::Long qw(:config no_auto_abbrev);
14 use Pod::Usage;
15 
18 
20 
21 main();
22 
23 
24 sub main {
25  my ($url, $reg_conf, $reg_type, $reg_alias, $nosqlvc, $job_id, $help);
26  my @languages;
27 
28  GetOptions(
29 
30  # Connection parameters:
31  'url=s' => \$url,
32  'reg_conf|regfile|reg_file=s' => \$reg_conf,
33  'reg_type=s' => \$reg_type,
34  'reg_alias|regname|reg_name=s' => \$reg_alias,
35  'nosqlvc' => \$nosqlvc, # using "nosqlvc" instead of "sqlvc!" for consistency with scripts where it is a propagated option
36 
37  # Other commands
38  'language=s@' => \@languages,
39  'h|help' => \$help,
40  ) or die "Error in command line arguments\n";
41 
42  if (@ARGV) {
43  die "ERROR: There are invalid arguments on the command-line: ". join(" ", @ARGV). "\n";
44  }
45 
46  if ($help) {
47  pod2usage({-exitvalue => 0, -verbose => 2});
48  }
49 
50  # All the languages that are registered
52 
53  my %requested_languages;
54 
55  if($url or $reg_alias) {
56 
57  my $pipeline = Bio::EnsEMBL::Hive::HivePipeline->new(
58  -url => $url,
59  -reg_conf => $reg_conf,
60  -reg_type => $reg_type,
61  -reg_alias => $reg_alias,
62  -no_sql_schema_version_check => $nosqlvc,
63  );
64 
65  my $found = 0;
66  foreach my $analysis ($pipeline->collection_of('Analysis')->list()) {
67  if ($analysis->language) {
68  $found = 1;
69  if ($wrappers->{$analysis->language}) {
70  $requested_languages{$analysis->language} = 1;
71  } else {
72  warn sprintf("Anaylsis '%s' is implemented in %s, but this wrapper is not registered.\n", $analysis->logic_name, $analysis->language);
73  }
74  }
75  }
76 
77  unless ($found) {
78  warn "All the analyses of this pipeline are implemented with the default language.\n";
79  }
80 
81  } elsif (scalar(@languages)) {
82  foreach my $language (@languages) {
83  if ($wrappers->{$language}) {
84  $requested_languages{$language} = 1;
85  } else {
86  warn "No wrapper for '$language' is registered.\n";
87  }
88  }
89 
90  } else {
91  $requested_languages{$_} = 1 for keys %$wrappers;
92 
93  }
94 
95  foreach my $language (keys %requested_languages) {
96  print "** $language **\n";
98  print "\n\n";
99  }
100 }
101 
102 
103 __DATA__
104 
105 =pod
106 
107 =head1 NAME
108 
109 refresh_guest_languages.pl [options]
110 
111 =head1 DESCRIPTION
112 
113 refresh_guest_languages.pl is an eHive component script that simplifies rebuilding the wrappers for guest languages
114 
115 =head1 USAGE EXAMPLES
116 
117  # Rebuild all the wrappers needed for an existing pipeline
118  refresh_guest_languages.pl --url mysql://username:secret@hostname:port/ehive_dbname
119 
120  # Rebuild one wrapper
121  refresh_guest_languages.pl --language python
122 
123  # Rebuild all the wrappers
124  refresh_guest_languages.pl
125 
126 =head1 OPTIONS
127 
128 =head2 Connection parameters:
129 
130 =over
131 
132 =item --reg_conf <path>
133 
134 path to a Registry configuration file
135 
136 =item --reg_alias <string>
137 
138 species/alias name for the eHive DBAdaptor
139 
140 =item --reg_type <string>
141 
142 type of the registry entry ("hive", "core", "compara", etc - defaults to "hive")
143 
144 =item --url <url string>
145 
146 URL defining where database is located
147 
148 =item --nosqlvc
149 
150 "No SQL Version Check" - set if you want to force working with a database created by a potentially schema-incompatible API
151 
152 =back
153 
154 =head2 Task specification parameters:
155 
156 =over
157 
158 =item --language <name>
159 
160 The name of a language whose wrapper has to be rebuilt.
161 The option can be repeated
162 
163 =back
164 
165 =head2 Other options:
166 
167 =over
168 
169 =item --help
170 
171 print this help
172 
173 =back
174 
175 =head1 LICENSE
176 
177  See the NOTICE file distributed with this work for additional information
178  regarding copyright ownership.
179 
180  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
181  You may obtain a copy of the License at
182 
183  http://www.apache.org/licenses/LICENSE-2.0
184 
185  Unless required by applicable law or agreed to in writing, software distributed under the License
186  is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
187  See the License for the specific language governing permissions and limitations under the License.
188 
189 =head1 CONTACT
190 
191 Please subscribe to the eHive mailing list: http://listserver.ebi.ac.uk/mailman/listinfo/ehive-users to discuss eHive-related questions or to be notified of our updates
192 
193 =cut
Bio::EnsEMBL::Hive::Utils::URL::hide_url_password
public Void hide_url_password()
Bio::EnsEMBL::Hive::GuestProcess
Definition: GuestProcess.pm:105
Bio::EnsEMBL::Hive::GuestProcess::build_wrapper_for_language
public void build_wrapper_for_language()
Bio::EnsEMBL::Hive::HivePipeline::new
public new()
Bio::EnsEMBL::Hive::HivePipeline
Definition: HivePipeline.pm:13
main
public main()
BEGIN
public BEGIN()
Bio::EnsEMBL::Hive::GuestProcess::_get_all_registered_wrappers
protected Hashref _get_all_registered_wrappers()