Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
ensembl-gh-mirror
ensembl-hive
Commits
14810a43
Commit
14810a43
authored
Apr 22, 2016
by
Leo Gordon
Browse files
added optional Accumulator::accu_input_variable parameter, changed examples+tests accordingly
parent
743984ec
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
42 additions
and
17 deletions
+42
-17
modules/Bio/EnsEMBL/Hive/Accumulator.pm
modules/Bio/EnsEMBL/Hive/Accumulator.pm
+24
-6
modules/Bio/EnsEMBL/Hive/Examples/LongMult/PipeConfig/LongMultServer_conf.pm
.../Hive/Examples/LongMult/PipeConfig/LongMultServer_conf.pm
+3
-1
modules/Bio/EnsEMBL/Hive/Examples/LongMult/PipeConfig/LongMultSt_conf.pm
...EMBL/Hive/Examples/LongMult/PipeConfig/LongMultSt_conf.pm
+1
-1
modules/Bio/EnsEMBL/Hive/Examples/LongMult/PipeConfig/LongMultWf_conf.pm
...EMBL/Hive/Examples/LongMult/PipeConfig/LongMultWf_conf.pm
+3
-3
modules/Bio/EnsEMBL/Hive/Examples/LongMult/PipeConfig/LongMult_conf.pm
...nsEMBL/Hive/Examples/LongMult/PipeConfig/LongMult_conf.pm
+1
-1
modules/Bio/EnsEMBL/Hive/Examples/LongMult/RunnableDB/PartMultiply.pm
...EnsEMBL/Hive/Examples/LongMult/RunnableDB/PartMultiply.pm
+3
-3
t/01.utils/url.t
t/01.utils/url.t
+7
-2
No files found.
modules/Bio/EnsEMBL/Hive/Accumulator.pm
View file @
14810a43
...
...
@@ -40,7 +40,7 @@ use base ( 'Bio::EnsEMBL::Hive::Cacheable', 'Bio::EnsEMBL::Hive::Storable' );
sub
unikey
{
# override the default from Cacheable parent
return
[
'
accu_name
',
'
accu_address
'
];
return
[
'
accu_name
',
'
accu_address
'
,
'
accu_input_variable
'
];
}
...
...
@@ -64,19 +64,36 @@ sub accu_address {
}
sub
accu_input_variable
{
my
$self
=
shift
@_
;
if
(
@
_
)
{
$self
->
{'
_accu_input_variable
'}
=
shift
@_
;
}
return
(
$self
->
{'
_accu_input_variable
'}
//
$self
->
accu_name
);
}
sub
url
{
my
(
$self
,
$ref_dba
)
=
@_
;
# if reference dba is the same as 'my' dba, a shorter url is generated
my
$my_dba
=
$self
->
adaptor
&&
$self
->
adaptor
->
db
;
return
(
(
$my_dba
and
$my_dba
ne
(
$ref_dba
//
'')
)
?
$my_dba
->
dbc
->
url
:
''
)
.
'
?accu_name=
'
.
$self
->
accu_name
.
(
$self
->
accu_address
?
'
&accu_address=
'
.
$self
->
accu_address
:
'');
.
'
?
'
.
join
('
&
',
'
accu_name=
'
.
$self
->
accu_name
,
(
$self
->
accu_address
?
('
accu_address=
'
.
$self
->
accu_address
)
:
()
),
'
accu_input_variable=
'
.
$self
->
accu_input_variable
,
);
}
sub
display_name
{
my
(
$self
)
=
@_
;
return
$self
->
accu_name
.
(
$self
->
accu_address
//
'');
return
$self
->
accu_name
.
(
$self
->
accu_address
//
'')
.
'
:=
'
.
$self
->
accu_input_variable
;
}
...
...
@@ -88,6 +105,7 @@ sub dataflow {
my
$accu_name
=
$self
->
accu_name
;
my
$accu_address
=
$self
->
accu_address
;
my
$accu_input_variable
=
$self
->
accu_input_variable
;
my
@rows
=
();
...
...
@@ -101,7 +119,7 @@ sub dataflow {
'
receiving_job_id
'
=>
$receiving_job_id
,
'
struct_name
'
=>
$accu_name
,
'
key_signature
'
=>
$key_signature
,
'
value
'
=>
stringify
(
$emitting_job
->
_param_possibly_overridden
(
$accu_
nam
e
,
$output_id
)
),
'
value
'
=>
stringify
(
$emitting_job
->
_param_possibly_overridden
(
$accu_
input_variabl
e
,
$output_id
)
),
};
}
...
...
@@ -112,7 +130,7 @@ sub dataflow {
sub
toString
{
my
$self
=
shift
@_
;
return
'
Accumulator(
'
.
$self
->
accu_name
.
'
<--
'
.
(
$self
->
accu_address
//
'')
.
'
)
';
return
'
Accumulator(
'
.
$self
->
display_name
.
'
)
';
}
1
;
...
...
modules/Bio/EnsEMBL/Hive/Examples/LongMult/PipeConfig/LongMultServer_conf.pm
View file @
14810a43
...
...
@@ -92,7 +92,9 @@ sub pipeline_analyses {
-
module
=>
'
Bio::EnsEMBL::Hive::Examples::LongMult::RunnableDB::PartMultiply
',
-
analysis_capacity
=>
4
,
# use per-analysis limiter
-
flow_into
=>
{
1
=>
[
'
?table_name=intermediate_result
'
],
1
=>
{
'
?table_name=intermediate_result
'
=>
{
'
a_multiplier
'
=>
'
#a_multiplier#
',
'
digit
'
=>
'
#digit#
',
'
partial_product
'
=>
'
#product#
'
},
}
},
},
];
...
...
modules/Bio/EnsEMBL/Hive/Examples/LongMult/PipeConfig/LongMultSt_conf.pm
View file @
14810a43
...
...
@@ -157,7 +157,7 @@ sub pipeline_analyses {
-
module
=>
'
Bio::EnsEMBL::Hive::Examples::LongMult::RunnableDB::PartMultiply
',
-
analysis_capacity
=>
4
,
# use per-analysis limiter
-
flow_into
=>
{
1
=>
[
'
?accu_name=partial_product&accu_address={digit}
'
],
1
=>
[
'
?accu_name=partial_product&accu_address={digit}
&accu_input_variable=product
'
],
},
},
...
...
modules/Bio/EnsEMBL/Hive/Examples/LongMult/PipeConfig/LongMultWf_conf.pm
View file @
14810a43
...
...
@@ -151,9 +151,9 @@ sub pipeline_analyses {
-
module
=>
'
Bio::EnsEMBL::Hive::Examples::LongMult::RunnableDB::PartMultiply
',
-
analysis_capacity
=>
4
,
# use per-analysis limiter
-
flow_into
=>
{
1
=>
[
'
?table_name=intermediate_result
',
]
,
1
=>
{
'
?table_name=intermediate_result
'
=>
{
'
a_multiplier
'
=>
'
#a_multiplier#
',
'
digit
'
=>
'
#digit#
',
'
partial_product
'
=>
'
#product#
'
}
,
}
,
},
-
can_be_empty
=>
1
,
},
...
...
modules/Bio/EnsEMBL/Hive/Examples/LongMult/PipeConfig/LongMult_conf.pm
View file @
14810a43
...
...
@@ -150,7 +150,7 @@ sub pipeline_analyses {
-
module
=>
'
Bio::EnsEMBL::Hive::Examples::LongMult::RunnableDB::PartMultiply
',
-
analysis_capacity
=>
4
,
# use per-analysis limiter
-
flow_into
=>
{
1
=>
[
'
?accu_name=partial_product&accu_address={digit}
'
],
1
=>
[
'
?accu_name=partial_product&accu_address={digit}
&accu_input_variable=product
'
],
},
},
...
...
modules/Bio/EnsEMBL/Hive/Examples/LongMult/RunnableDB/PartMultiply.pm
View file @
14810a43
...
...
@@ -12,7 +12,7 @@
=head1 DESCRIPTION
'Bio::EnsEMBL::Hive::Examples::LongMult::RunnableDB::PartMultiply' has a separate task of multiplying 'a_multiplier' by the given 'digit',
then it passes its partial
_
product on.
then it passes its partial
product on.
=head1 LICENSE
...
...
@@ -85,7 +85,7 @@ sub run { # call the recursive function that will compute the stuff
my
$a_multiplier
=
$self
->
param_required
('
a_multiplier
');
my
$digit
=
$self
->
param_required
('
digit
');
$self
->
param
('
partial_
product
',
_rec_multiply
(
$a_multiplier
,
$digit
,
0
)
||
0
);
$self
->
param
('
product
',
_rec_multiply
(
$a_multiplier
,
$digit
,
0
)
||
0
);
sleep
(
$self
->
param
('
take_time
')
);
}
...
...
@@ -101,7 +101,7 @@ sub write_output { # but this time we have something to store
my
$self
=
shift
@_
;
$self
->
dataflow_output_id
(
{
'
partial_
product
'
=>
$self
->
param
('
partial_
product
')
'
product
'
=>
$self
->
param
('
product
')
},
1
);
}
...
...
t/01.utils/url.t
View file @
14810a43
...
...
@@ -164,14 +164,19 @@ BEGIN {
}
{
# NEW style accu URL:
my
$url
=
'
?accu_name=intermediate_result&accu_address={digit}
';
my
$url
=
'
?accu_name=intermediate_result
s
&accu_address={digit}
&accu_input_variable=partial_product
';
my
$url_hash
=
Bio::EnsEMBL::Hive::Utils::URL::
parse
(
$url
);
ok
(
$url_hash
,
"
parser returned something for
$url
");
isa_ok
(
$url_hash
,
'
HASH
'
);
is_deeply
(
$url_hash
->
{'
query_params
'},
{
'
object_type
'
=>
'
Accumulator
',
'
accu_name
'
=>
'
intermediate_result
',
'
accu_address
'
=>
'
{digit}
'
},
'
query_params hash correct
'
);
is_deeply
(
$url_hash
->
{'
query_params
'},
{
'
object_type
'
=>
'
Accumulator
',
'
accu_name
'
=>
'
intermediate_results
',
'
accu_address
'
=>
'
{digit}
',
'
accu_input_variable
'
=>
'
partial_product
',
},
'
query_params hash correct
'
);
}
{
# NEW style registry DB URL:
...
...
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