Commit 61b32d10 authored by Matthieu Muffato's avatar Matthieu Muffato
Browse files

Run seed_pipeline before beekeeper, and avoid recreating a new database

parent fa4c1edd
......@@ -37,32 +37,39 @@ my @pipeline_urls = (
);
foreach my $long_mult_version (qw(LongMult_conf LongMultSt_conf LongMultWf_conf)) {
foreach my $with_beekeeper (0..1) {
foreach my $pipeline_url (@pipeline_urls) {
my $hive_dba = init_pipeline('Bio::EnsEMBL::Hive::PipeConfig::'.$long_mult_version, [-pipeline_url => $pipeline_url, -hive_force_init => 1]);
my $job_adaptor = $hive_dba->get_AnalysisJobAdaptor;
# First run a single worker in this process
runWorker($hive_dba, { can_respecialize => 1 });
is(scalar(@{$job_adaptor->fetch_all('status != "DONE"')}), 0, 'All the jobs could be run');
# Let's now try the combination of end-user scripts: seed_pipeline + beekeeper
{
my @seed_pipeline_cmd = ($ENV{'EHIVE_ROOT_DIR'}.'/scripts/seed_pipeline.pl', -url => $hive_dba->dbc->url, -logic_name => 'take_b_apart', -input_id => '{"a_multiplier" => 2222222222, "b_multiplier" => 3434343434}');
my @beekeeper_cmd = ($ENV{'EHIVE_ROOT_DIR'}.'/scripts/beekeeper.pl', -url => $hive_dba->dbc->url, -sleep => 0.1, '-loop', '-local');
if ($with_beekeeper) {
my @beekeeper_cmd = ($ENV{'EHIVE_ROOT_DIR'}.'/scripts/beekeeper.pl', '-url', $hive_dba->dbc->url, '-loop', '-local');
# beekeeper can take a while and has its own DBConnection, it
# is better to close ours to avoid "MySQL server has gone away"
$hive_dba->dbc->disconnect_if_idle;
system(@seed_pipeline_cmd);
ok(!$?, 'seed_pipeline exited with the return code 0');
ok(scalar(@{$job_adaptor->fetch_all('status != "DONE"')}), 'There are new jobs to run');
system(@beekeeper_cmd);
ok(!$?, 'beekeeper exited with the return code 0');
is(scalar(@{$job_adaptor->fetch_all('status != "DONE"')}), 0, 'All the jobs could be run');
} else {
runWorker($hive_dba, { can_respecialize => 1 });
is(scalar(@{$job_adaptor->fetch_all('status != "DONE"')}), 0, 'All the jobs could be run');
}
my $results = $hive_dba->dbc->db_handle->selectall_arrayref('SELECT * FROM final_result');
ok(scalar(@$results), 'There are some results');
is(scalar(@$results), 3, 'There are exactly 3 results');
ok($_->[0]*$_->[1] eq $_->[2], sprintf("%s*%s=%s", $_->[0], $_->[1], $_->[0]*$_->[1])) for @$results;
system( @{ dbc_to_cmd($hive_dba->dbc, undef, undef, undef, 'DROP DATABASE') } );
}
}
last;
}
done_testing();
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment