Skip to content
Snippets Groups Projects
Commit 8b9a6a2c authored by Leo Gordon's avatar Leo Gordon
Browse files

Make sure automatic re-balancing of semaphores only happens for pipelines that...

Make sure automatic re-balancing of semaphores only happens for pipelines that have specifically asked for it.
parent 233d944e
No related branches found
No related tags found
No related merge requests found
......@@ -154,7 +154,7 @@ sub hive_use_triggers { # getter only, not setter
unless( defined($self->{'_hive_use_triggers'}) ) {
my $hive_use_triggers = $self->get_MetaAdaptor->get_value_by_key( 'hive_use_triggers' );
$self->{'_hive_use_triggers'} = $hive_use_triggers || 0;
$self->{'_hive_use_triggers'} = $hive_use_triggers // 0;
}
return $self->{'_hive_use_triggers'};
}
......@@ -165,12 +165,23 @@ sub hive_use_param_stack { # getter only, not setter
unless( defined($self->{'_hive_use_param_stack'}) ) {
my $hive_use_param_stack = $self->get_MetaAdaptor->get_value_by_key( 'hive_use_param_stack' );
$self->{'_hive_use_param_stack'} = $hive_use_param_stack || 0;
$self->{'_hive_use_param_stack'} = $hive_use_param_stack // 0;
}
return $self->{'_hive_use_param_stack'};
}
sub hive_auto_rebalance_semaphores { # getter only, not setter
my $self = shift @_;
unless( defined($self->{'_hive_auto_rebalance_semaphores'}) ) {
my $hive_auto_rebalance_semaphores = $self->get_MetaAdaptor->get_value_by_key( 'hive_auto_rebalance_semaphores' );
$self->{'_hive_auto_rebalance_semaphores'} = $hive_auto_rebalance_semaphores // 0;
}
return $self->{'_hive_auto_rebalance_semaphores'};
}
our %adaptor_type_2_package_name = (
'Accumulator' => 'Bio::EnsEMBL::Hive::DBSQL::AccumulatorAdaptor',
'Analysis' => 'Bio::EnsEMBL::Hive::DBSQL::AnalysisAdaptor',
......
......@@ -104,10 +104,11 @@ sub default_options {
'dbowner' => $ENV{'EHIVE_USER'} || $ENV{'USER'} || $self->o('dbowner'), # although it is very unlikely $ENV{USER} is not set
'pipeline_name' => $self->pipeline_name(),
'hive_use_triggers' => 0, # there have been a few cases of big pipelines misbehaving with triggers on, let's keep the default off.
'hive_use_param_stack' => 0, # do not reconstruct the calling stack of parameters by default (yet)
'hive_force_init' => 0, # setting it to 1 will drop the database prior to creation (use with care!)
'hive_no_init' => 0, # setting it to 1 will skip pipeline_create_commands (useful for topping up)
'hive_use_triggers' => 0, # there have been a few cases of big pipelines misbehaving with triggers on, let's keep the default off.
'hive_use_param_stack' => 0, # do not reconstruct the calling stack of parameters by default (yet)
'hive_auto_rebalance_semaphores' => 0, # do not attempt to rebalance semaphores periodically by default
'hive_force_init' => 0, # setting it to 1 will drop the database prior to creation (use with care!)
'hive_no_init' => 0, # setting it to 1 will skip pipeline_create_commands (useful for topping up)
'pipeline_db' => {
-driver => $self->o('hive_driver'),
......@@ -226,9 +227,10 @@ sub hive_meta_table {
my ($self) = @_;
return {
'hive_sql_schema_version' => Bio::EnsEMBL::Hive::DBSQL::SqlSchemaAdaptor->get_code_sql_schema_version(),
'hive_pipeline_name' => $self->o('pipeline_name'),
'hive_use_param_stack' => $self->o('hive_use_param_stack'),
'hive_sql_schema_version' => Bio::EnsEMBL::Hive::DBSQL::SqlSchemaAdaptor->get_code_sql_schema_version(),
'hive_pipeline_name' => $self->o('pipeline_name'),
'hive_use_param_stack' => $self->o('hive_use_param_stack'),
'hive_auto_rebalance_semaphores' => $self->o('hive_auto_rebalance_semaphores'),
};
}
......
......@@ -66,8 +66,14 @@ sub schedule_workers_resync_if_necessary {
print "Scheduler: mismatch between DB's active Roles and Valley's running Workers detected, checking for dead workers...\n";
$queen->check_for_dead_workers($valley, 1);
}
print "Scheduler: re-balancing of semaphore_counts...\n";
$queen->db->get_AnalysisJobAdaptor->balance_semaphores($filter_analysis && $filter_analysis->dbID);
if($queen->db->hive_auto_rebalance_semaphores) { # make sure rebalancing only ever happens for the pipelines that asked for it
print "Scheduler: re-balancing of semaphore_counts...\n";
$queen->db->get_AnalysisJobAdaptor->balance_semaphores($filter_analysis && $filter_analysis->dbID);
} else {
print "Scheduler: automatic re-balancing of semaphore_counts is off by default. If you think your pipeline might benefit from it, set hive_auto_rebalance_semaphores => 1 in the PipeConfig's hive_meta_table.\n";
}
print "Scheduler: re-synchronizing the Hive...\n";
$queen->synchronize_hive($filter_analysis);
......
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