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

EMPTY state added and definitions of READY and WORKING made more intuitive

parent 5b0756a2
......@@ -326,7 +326,7 @@ sub check_blocking_control_rules {
my $condition_tjc = $condition_stats && $condition_stats->total_job_count;
my $this_condition_satisfied = ($condition_status eq 'DONE')
|| ($condition_cbe && !$condition_tjc);
|| ($condition_cbe && !$condition_tjc); # probably safer than saying ($condition_status eq 'EMPTY') because of the sync order
unless( $this_condition_satisfied ) {
$all_conditions_satisfied = 0;
......@@ -350,11 +350,11 @@ sub determine_status {
my $self = shift;
if($self->status ne 'BLOCKED') {
if($self->ready_job_count == $self->total_job_count) { # nothing has been claimed yet (or an empty analysis)
if( !$self->total_job_count ) {
$self->status('READY');
$self->status('EMPTY');
} elsif( $self->total_job_count == $self->done_job_count + $self->failed_job_count ) { # all jobs of the analysis have been tried
} elsif( $self->total_job_count == $self->done_job_count + $self->failed_job_count ) { # all jobs of the analysis have been finished
my $analysis = $self->get_analysis;
my $absolute_tolerance = $analysis->failed_job_tolerance * $self->total_job_count / 100.0;
if ($self->failed_job_count > $absolute_tolerance) {
......@@ -366,11 +366,15 @@ sub determine_status {
} else {
$self->status('DONE');
}
} elsif ($self->ready_job_count == 0 ) { # everything has been claimed
} elsif( $self->ready_job_count && !$self->inprogress_job_count ) { # there are claimable jobs, but nothing actually running
$self->status('READY');
} elsif( !$self->ready_job_count ) { # there are no claimable jobs, possibly because some are semaphored
$self->status('ALL_CLAIMED');
} elsif( 0 < $self->ready_job_count and $self->ready_job_count < $self->total_job_count ) {
} elsif( $self->inprogress_job_count ) {
$self->status('WORKING');
}
......
......@@ -431,7 +431,7 @@ sub run {
-analysis_id => $analysis->dbID,
-batch_size => $batch_size,
-hive_capacity => $hive_capacity,
-status => $blocked ? 'BLOCKED' : 'READY', # be careful, as this "soft" way of blocking may be accidentally unblocked by deep sync
-status => $blocked ? 'BLOCKED' : 'EMPTY', # be careful, as this "soft" way of blocking may be accidentally unblocked by deep sync
);
$analysis_stats_adaptor->store($stats);
}
......
# Adding an 'EMPTY' status:
ALTER TABLE analysis_stats MODIFY COLUMN status enum('BLOCKED', 'LOADING', 'SYNCHING', 'EMPTY', 'READY', 'WORKING', 'ALL_CLAIMED', 'DONE', 'FAILED') DEFAULT 'EMPTY' NOT NULL;
ALTER TABLE analysis_stats_monitor MODIFY COLUMN status enum('BLOCKED', 'LOADING', 'SYNCHING', 'EMPTY', 'READY', 'WORKING', 'ALL_CLAIMED', 'DONE', 'FAILED') DEFAULT 'EMPTY' NOT NULL;
......@@ -332,7 +332,7 @@ CREATE TABLE analysis_stats (
analysis_id int(10) unsigned NOT NULL,
batch_size int(10) DEFAULT 1 NOT NULL,
hive_capacity int(10) DEFAULT 1 NOT NULL,
status enum('BLOCKED', 'LOADING', 'SYNCHING', 'READY', 'WORKING', 'ALL_CLAIMED', 'DONE', 'FAILED') DEFAULT 'READY' NOT NULL,
status enum('BLOCKED', 'LOADING', 'SYNCHING', 'EMPTY', 'READY', 'WORKING', 'ALL_CLAIMED', 'DONE', 'FAILED') DEFAULT 'EMPTY' NOT NULL,
total_job_count int(10) DEFAULT 0 NOT NULL,
semaphored_job_count int(10) DEFAULT 0 NOT NULL,
......@@ -366,7 +366,7 @@ CREATE TABLE analysis_stats_monitor (
analysis_id int(10) unsigned NOT NULL,
batch_size int(10) DEFAULT 1 NOT NULL,
hive_capacity int(10) DEFAULT 1 NOT NULL,
status enum('BLOCKED', 'LOADING', 'SYNCHING', 'READY', 'WORKING', 'ALL_CLAIMED', 'DONE', 'FAILED') DEFAULT 'READY' NOT NULL,
status enum('BLOCKED', 'LOADING', 'SYNCHING', 'EMPTY', 'READY', 'WORKING', 'ALL_CLAIMED', 'DONE', 'FAILED') DEFAULT 'EMPTY' NOT NULL,
total_job_count int(10) DEFAULT 0 NOT NULL,
semaphored_job_count int(10) DEFAULT 0 NOT NULL,
......
......@@ -311,7 +311,7 @@ CREATE TABLE analysis_stats (
analysis_id INTEGER NOT NULL,
batch_size int(10) default 1 NOT NULL,
hive_capacity int(10) default 1 NOT NULL,
status TEXT DEFAULT 'READY' NOT NULL, /* enum('BLOCKED', 'LOADING', 'SYNCHING', 'READY', 'WORKING', 'ALL_CLAIMED', 'DONE', 'FAILED') DEFAULT 'READY' NOT NULL, */
status TEXT DEFAULT 'EMPTY' NOT NULL, /* enum('BLOCKED', 'LOADING', 'SYNCHING', 'EMPTY', 'READY', 'WORKING', 'ALL_CLAIMED', 'DONE', 'FAILED') DEFAULT 'EMPTY' NOT NULL, */
total_job_count int(10) NOT NULL DEFAULT 0,
ready_job_count int(10) NOT NULL DEFAULT 0,
......@@ -341,7 +341,7 @@ CREATE TABLE analysis_stats_monitor (
analysis_id INTEGER NOT NULL,
batch_size int(10) default 1 NOT NULL,
hive_capacity int(10) default 1 NOT NULL,
status TEXT DEFAULT 'READY' NOT NULL, /* enum('BLOCKED', 'LOADING', 'SYNCHING', 'READY', 'WORKING', 'ALL_CLAIMED', 'DONE', 'FAILED') DEFAULT 'READY' NOT NULL, */
status TEXT DEFAULT 'EMPTY' NOT NULL, /* enum('BLOCKED', 'LOADING', 'SYNCHING', 'EMPTY', 'READY', 'WORKING', 'ALL_CLAIMED', 'DONE', 'FAILED') DEFAULT 'EMPTY' NOT NULL, */
total_job_count int(10) NOT NULL DEFAULT 0,
ready_job_count int(10) NOT NULL DEFAULT 0,
......
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