Commit f55406be authored by Leo Gordon's avatar Leo Gordon
Browse files

added analysis_base.comment and analysis_base.tags

parent 9316e72d
......@@ -97,10 +97,26 @@ sub parameters {
}
sub comment {
my $self = shift;
$self->{'_comment'} = shift if(@_);
$self->{'_comment'} //= '';
return $self->{'_comment'};
}
sub tags {
my $self = shift;
$self->{'_tags'} = shift if(@_);
$self->{'_tags'} //= '';
return $self->{'_tags'};
}
sub failed_job_tolerance {
my $self = shift;
$self->{'_failed_job_tolerance'} = shift if(@_);
$self->{'_failed_job_tolerance'} = 0 unless(defined($self->{'_failed_job_tolerance'}));
$self->{'_failed_job_tolerance'} //= 0;
return $self->{'_failed_job_tolerance'};
}
......@@ -115,7 +131,7 @@ sub max_retry_count {
sub can_be_empty {
my $self = shift;
$self->{'_can_be_empty'} = shift if(@_);
$self->{'_can_be_empty'} = 0 unless(defined($self->{'_can_be_empty'}));
$self->{'_can_be_empty'} //= 0;
return $self->{'_can_be_empty'};
}
......@@ -123,7 +139,7 @@ sub can_be_empty {
sub priority {
my $self = shift;
$self->{'_priority'} = shift if(@_);
$self->{'_priority'} = 0 unless(defined($self->{'_priority'}));
$self->{'_priority'} //= 0;
return $self->{'_priority'};
}
......@@ -150,7 +166,7 @@ sub hive_capacity {
sub batch_size {
my $self = shift;
$self->{'_batch_size'} = shift if(@_);
$self->{'_batch_size'} = 1 unless(defined($self->{'_batch_size'})); # only initialize when undefined, so if defined as 0 will stay 0
$self->{'_batch_size'} //= 1; # only initialize when undefined, so if defined as 0 will stay 0
return $self->{'_batch_size'};
}
......
......@@ -127,8 +127,9 @@ sub pipeline_analyses {
my ($self) = @_;
return [
{ -logic_name => 'take_b_apart',
-comment => "A factory that takes in #b_multiplier# and dataflows all its unique non-trivial digits into #2",
-module => 'Bio::EnsEMBL::Hive::Examples::LongMult::RunnableDB::DigitFactory',
-meadow_type=> 'LOCAL', # do not bother the farm with such a simple task (and get it done faster)
-meadow_type => 'LOCAL', # do not bother the farm with such a simple task (and get it done faster)
-analysis_capacity => 2, # use per-analysis limiter
-input_ids => [
{ 'a_multiplier' => '9650156169', 'b_multiplier' => '327358788' },
......@@ -148,6 +149,7 @@ sub pipeline_analyses {
},
{ -logic_name => 'part_multiply',
-comment => "Multiplies #a_multiplier# by #digit# and dataflows #product# into #1",
-module => 'Bio::EnsEMBL::Hive::Examples::LongMult::RunnableDB::PartMultiply',
-analysis_capacity => 4, # use per-analysis limiter
-flow_into => {
......@@ -156,6 +158,7 @@ sub pipeline_analyses {
},
{ -logic_name => 'add_together',
-comment => "Takes in #a_multiplier#, #b_multiplier# and the #partial_product# hash and dataflows the product of #a_multiplier# and #b_multiplier# into #1",
-module => 'Bio::EnsEMBL::Hive::Examples::LongMult::RunnableDB::AddTogether',
-flow_into => {
1 => [ '?table_name=final_result' ],
......
......@@ -469,9 +469,9 @@ sub add_objects_from_config {
warn "Adding Analyses ...\n";
foreach my $aha (@{$self->pipeline_analyses}) {
my %aha_copy = %$aha;
my ($logic_name, $module, $parameters_hash, $input_ids, $blocked, $batch_size, $hive_capacity, $failed_job_tolerance,
my ($logic_name, $module, $parameters_hash, $comment, $tags, $input_ids, $blocked, $batch_size, $hive_capacity, $failed_job_tolerance,
$max_retry_count, $can_be_empty, $rc_id, $rc_name, $priority, $meadow_type, $analysis_capacity, $language, $wait_for, $flow_into)
= delete @aha_copy{qw(-logic_name -module -parameters -input_ids -blocked -batch_size -hive_capacity -failed_job_tolerance
= delete @aha_copy{qw(-logic_name -module -parameters -comment -tags -input_ids -blocked -batch_size -hive_capacity -failed_job_tolerance
-max_retry_count -can_be_empty -rc_id -rc_name -priority -meadow_type -analysis_capacity -language -wait_for -flow_into)}; # slicing a hash reference
my @unparsed_attribs = keys %aha_copy;
......@@ -520,6 +520,8 @@ sub add_objects_from_config {
'module' => $module,
'language' => $language,
'parameters' => $parameters_hash,
'comment' => $comment,
'tags' => $tags,
'resource_class' => $resource_class,
'failed_job_tolerance' => $failed_job_tolerance,
'max_retry_count' => $max_retry_count,
......
-- ---------------------------------------------------------------------------------------------------
SET @expected_version = 90;
-- make MySQL stop immediately after it encounters division by zero:
SET SESSION sql_mode='TRADITIONAL';
-- warn that we detected the schema version mismatch:
SELECT CONCAT( 'The patch only applies to schema version ',
@expected_version,
', but the current schema version is ',
meta_value,
', so skipping the rest.') AS ''
FROM hive_meta WHERE meta_key='hive_sql_schema_version' AND meta_value<>@expected_version;
-- cause division by zero only if current version differs from the expected one:
INSERT INTO hive_meta (meta_key, meta_value)
SELECT 'this_should_never_be_inserted', 1 FROM hive_meta WHERE NOT 1/(meta_key<>'hive_sql_schema_version' OR meta_value=@expected_version);
SELECT CONCAT( 'The patch seems to be compatible with schema version ',
@expected_version,
', applying the patch...') AS '';
-- Now undo the change so that we could patch potentially non-TRADITIONAL schema:
SET SESSION sql_mode='';
-- ----------------------------------<actual_patch> -------------------------------------------------
--
-- Adding two text columns to Analysis object:
-- one for human-readable description of the anlaysis
-- and another one for tagging analyses into groups for easier tweaking
ALTER TABLE analysis_base ADD COLUMN comment TEXT NOT NULL DEFAULT '';
ALTER TABLE analysis_base ADD COLUMN tags TEXT NOT NULL DEFAULT '';
-- ----------------------------------</actual_patch> -------------------------------------------------
-- increase the schema version by one and register the patch:
UPDATE hive_meta SET meta_value=meta_value+1 WHERE meta_key='hive_sql_schema_version';
INSERT INTO hive_meta (meta_key, meta_value) SELECT CONCAT("patched_to_", meta_value), CURRENT_TIMESTAMP FROM hive_meta WHERE meta_key = "hive_sql_schema_version";
-- ---------------------------------------------------------------------------------------------------
\set expected_version 90
\set ON_ERROR_STOP on
-- warn that we detected the schema version mismatch:
SELECT ('The patch only applies to schema version '
|| CAST(:expected_version AS VARCHAR)
|| ', but the current schema version is '
|| meta_value
|| ', so skipping the rest.') as incompatible_msg
FROM hive_meta WHERE meta_key='hive_sql_schema_version' AND meta_value!=CAST(:expected_version AS VARCHAR);
-- cause division by zero only if current version differs from the expected one:
INSERT INTO hive_meta (meta_key, meta_value)
SELECT 'this_should_never_be_inserted', 1 FROM hive_meta WHERE 1 != 1/CAST( (meta_key!='hive_sql_schema_version' OR meta_value=CAST(:expected_version AS VARCHAR)) AS INTEGER );
SELECT ('The patch seems to be compatible with schema version '
|| CAST(:expected_version AS VARCHAR)
|| ', applying the patch...') AS compatible_msg;
-- ----------------------------------<actual_patch> -------------------------------------------------
--
-- Adding two text columns to Analysis object:
-- one for human-readable description of the anlaysis
-- and another one for tagging analyses into groups for easier tweaking
ALTER TABLE analysis_base ADD COLUMN comment TEXT NOT NULL DEFAULT '';
ALTER TABLE analysis_base ADD COLUMN tags TEXT NOT NULL DEFAULT '';
-- ----------------------------------</actual_patch> -------------------------------------------------
-- increase the schema version by one and register the patch:
UPDATE hive_meta SET meta_value= (CAST(meta_value AS INTEGER) + 1) WHERE meta_key='hive_sql_schema_version';
INSERT INTO hive_meta (meta_key, meta_value) SELECT 'patched_to_' || meta_value, CURRENT_TIMESTAMP FROM hive_meta WHERE meta_key = 'hive_sql_schema_version';
......@@ -100,6 +100,8 @@ CREATE TABLE pipeline_wide_parameters (
@column analysis_capacity if defined, limits the number of Workers of this particular Analysis that are allowed to run in parallel
@column hive_capacity a reciprocal limiter on the number of Workers running at the same time (dependent on Workers of other Analyses)
@column batch_size how many jobs are claimed in one claiming operation before Worker starts executing them
@column comment human-readable textual description of the analysis
@column tags machine-readable list of tags useful for grouping analyses together
*/
CREATE TABLE analysis_base (
......@@ -117,6 +119,8 @@ CREATE TABLE analysis_base (
analysis_capacity INTEGER DEFAULT NULL,
hive_capacity INTEGER DEFAULT NULL,
batch_size INTEGER NOT NULL DEFAULT 1,
comment TEXT NOT NULL DEFAULT '',
tags TEXT NOT NULL DEFAULT '',
UNIQUE KEY logic_name_idx (logic_name)
) COLLATE=latin1_swedish_ci ENGINE=InnoDB;
......
......@@ -102,6 +102,8 @@ CREATE INDEX ON pipeline_wide_parameters (param_value);
@column analysis_capacity if defined, limits the number of Workers of this particular Analysis that are allowed to run in parallel
@column hive_capacity a reciprocal limiter on the number of Workers running at the same time (dependent on Workers of other Analyses)
@column batch_size how many jobs are claimed in one claiming operation before Worker starts executing them
@column comment human-readable textual description of the analysis
@column tags machine-readable list of tags useful for grouping analyses together
*/
CREATE TABLE analysis_base (
......@@ -119,6 +121,8 @@ CREATE TABLE analysis_base (
analysis_capacity INTEGER DEFAULT NULL,
hive_capacity INTEGER DEFAULT NULL,
batch_size INTEGER NOT NULL DEFAULT 1,
comment TEXT NOT NULL DEFAULT '',
tags TEXT NOT NULL DEFAULT '',
UNIQUE (logic_name)
);
......
......@@ -102,6 +102,8 @@ CREATE INDEX pipeline_wide_parameters_value_idx ON pipeline_wide_para
@column analysis_capacity if defined, limits the number of Workers of this particular Analysis that are allowed to run in parallel
@column hive_capacity a reciprocal limiter on the number of Workers running at the same time (dependent on Workers of other Analyses)
@column batch_size how many jobs are claimed in one claiming operation before Worker starts executing them
@column comment human-readable textual description of the analysis
@column tags machine-readable list of tags useful for grouping analyses together
*/
CREATE TABLE analysis_base (
......@@ -118,7 +120,9 @@ CREATE TABLE analysis_base (
meadow_type VARCHAR(255) DEFAULT NULL,
analysis_capacity INTEGER DEFAULT NULL,
hive_capacity INTEGER DEFAULT NULL,
batch_size INTEGER NOT NULL DEFAULT 1
batch_size INTEGER NOT NULL DEFAULT 1,
comment TEXT NOT NULL DEFAULT '',
tags TEXT NOT NULL DEFAULT ''
);
CREATE UNIQUE INDEX analysis_base_logic_name_idx ON analysis_base (logic_name);
......
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