3 # See the NOTICE file distributed with this work for additional information
4 # regarding copyright ownership.
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
10 # http://www.apache.org/licenses/LICENSE-2.0
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
18 package Bio::EnsEMBL::Hive::Scripts::PeekJob;
25 my ($pipeline, $job_id) = @_;
27 my $hive_dba = $pipeline->hive_dba;
28 die
"Hive's DBAdaptor is not a defined Bio::EnsEMBL::Hive::DBSQL::DBAdaptor\n" unless $hive_dba and $hive_dba->isa(
'Bio::EnsEMBL::Hive::DBSQL::DBAdaptor');
30 # fetch job and populate params
31 my $job_adaptor = $hive_dba->get_AnalysisJobAdaptor;
32 my $job = $job_adaptor->fetch_by_dbID( $job_id );
33 die
"Cannot find job with id $job_id\n" unless $job;
34 $job->load_parameters;
35 my $analysis_id = $job->analysis_id;
36 my $logic_name = $job->analysis->logic_name;
38 my $label =
"[ Analysis $logic_name ($analysis_id) Job $job_id ]";
39 return _stringify_params($job->{
'_unsubstituted_param_hash'}, $label);
42 sub _stringify_params {
43 my ($params, $label) = @_;
45 local $Data::Dumper::Sortkeys = 1;
46 local $Data::Dumper::Deepcopy = 1;
47 local $Data::Dumper::Indent = 1;
49 return Data::Dumper->Dump( [ $params ], [ qq(*unsubstituted_param_hash $label) ] );