Commit 77675743 authored by Jessica Severin's avatar Jessica Severin
Browse files

switched back to analysis_job.input_id

changed to varchar(255) (but dropped joining to analysis_data table)
If modules need more than 255 characters of input_id
they can pass the anaysis_data_id via the varchar(255) : example {adid=>365902}
parent 41edb25e
......@@ -42,7 +42,6 @@ package Bio::EnsEMBL::Hive::DBSQL::AnalysisJobAdaptor;
use strict;
use Bio::EnsEMBL::Hive::Worker;
use Bio::EnsEMBL::Hive::AnalysisJob;
use Bio::EnsEMBL::Hive::DBSQL::AnalysisDataAdaptor;
use Bio::EnsEMBL::DBSQL::BaseAdaptor;
use Sys::Hostname;
use Data::UUID;
......@@ -63,30 +62,24 @@ sub CreateNewJob {
return undef unless(scalar @args);
my ($input_id, $input_analysis_data_id, $analysis, $prev_analysis_job_id, $blocked) =
rearrange([qw(INPUT_ID INPUT_ANALYSIS_DATA_ID ANALYSIS input_job_id BLOCK )], @args);
my ($input_id, $analysis, $prev_analysis_job_id, $blocked) =
rearrange([qw(INPUT_ID ANALYSIS input_job_id BLOCK )], @args);
$prev_analysis_job_id=0 unless($prev_analysis_job_id);
throw("must define input_id or input_analysis_data_id") unless($input_id or $input_analysis_data_id);
throw("must define input_id") unless($input_id);
throw("must define analysis") unless($analysis);
throw("analysis must be [Bio::EnsEMBL::Analysis] not a [$analysis]")
unless($analysis->isa('Bio::EnsEMBL::Analysis'));
throw("analysis must have adaptor connected to database")
unless($analysis->adaptor and $analysis->adaptor->db);
my $dbc = $analysis->adaptor->db->dbc;
unless(defined($input_analysis_data_id)) {
my $dataDBA = $analysis->adaptor->db->get_AnalysisDataAdaptor;
$input_analysis_data_id = $dataDBA->store($input_id);
}
my $sql = "INSERT ignore into analysis_job ".
" SET input_analysis_data_id=\"$input_analysis_data_id\" ".
" SET input_id=\"$input_id\" ".
" ,prev_analysis_job_id='$prev_analysis_job_id' ".
" ,analysis_id='".$analysis->dbID ."' ";
$sql .= " ,status='BLOCKED', job_claim='BLOCKED'" if($blocked);
my $dbc = $analysis->adaptor->db->dbc;
my $sth = $dbc->prepare($sql);
$sth->execute();
my $dbID = $sth->{'mysql_insertid'};
......@@ -240,7 +233,7 @@ sub _generic_fetch {
sub _tables {
my $self = shift;
return (['analysis_job', 'a'],['analysis_data', 'ad']);
return (['analysis_job', 'a']);
}
......@@ -250,21 +243,19 @@ sub _columns {
return qw (a.analysis_job_id
a.prev_analysis_job_id
a.analysis_id
a.input_analysis_data_id
a.output_analysis_data_id
a.input_id
a.job_claim
a.hive_id
a.status
a.retry_count
a.completed
a.branch_code
ad.data
);
}
sub _default_where_clause {
my $self = shift;
return 'ad.analysis_data_id=a.input_analysis_data_id';
return '';
}
......@@ -287,13 +278,13 @@ sub _objs_from_sth {
$job->dbID($column{'analysis_job_id'});
$job->analysis_id($column{'analysis_id'});
$job->input_id($column{'input_id'});
$job->job_claim($column{'job_claim'});
$job->hive_id($column{'hive_id'});
$job->status($column{'status'});
$job->retry_count($column{'retry_count'});
$job->completed($column{'completed'});
$job->branch_code($column{'branch_code'});
$job->input_id($column{'data'});
$job->adaptor($self);
push @jobs, $job;
......
......@@ -138,10 +138,7 @@ CREATE TABLE analysis_ctrl_rule (
-- analysis_job_id - autoincrement id
-- prev_analysis_job_id - previous analysis_job which created this one (and passed input_id)
-- analysis_id - the analysis_id needed to accomplish this job.
-- input_analysis_data_id - input data passed into Analysis:RunnableDB to control the work
-- foreign key join to analysis_data table
-- output_analysis_data_id - ouput data passed from Analysis:RunnableDB to be passed to next job
-- foreign key join to analysis_data table
-- input_id - input data passed into Analysis:RunnableDB to control the work
-- job_claim - UUID set by workers as the fight over jobs
-- hive_id - link to hive table to define which worker claimed this job
-- status - state the job is in
......@@ -153,8 +150,7 @@ CREATE TABLE analysis_job (
analysis_job_id int(10) NOT NULL auto_increment,
prev_analysis_job_id int(10) NOT NULL, #analysis_job which created this from rules
analysis_id int(10) NOT NULL,
input_analysis_data_id int(10) NOT NULL,
output_analysis_data_id int(10) default 0 NOT NULL,
input_id varchar(255) not null,
job_claim varchar(40) NOT NULL default '', #UUID
hive_id int(10) NOT NULL,
status enum('READY','BLOCKED','CLAIMED','GET_INPUT','RUN','WRITE_OUTPUT','DONE','FAILED') DEFAULT 'READY' NOT NULL,
......@@ -163,7 +159,7 @@ CREATE TABLE analysis_job (
branch_code int(10) default 1 NOT NULL,
PRIMARY KEY (analysis_job_id),
UNIQUE KEY input_id_analysis (input_analysis_data_id, analysis_id),
UNIQUE KEY input_id_analysis (input_id, analysis_id),
INDEX claim_analysis_status (job_claim, analysis_id, status),
INDEX analysis_status (analysis_id, status),
INDEX hive_id (hive_id)
......
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