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

added -pid cmdline option to set the workers process_id externally.

Can't seem to figure out way of passing lsf job_id and array_index as parameter
so hardcoded access of environment variables LSB_JOBID and LSB_JOBINDEX
inside runWorker script.  If both variables are set this should imply that the
worker was created by an lsf deamon and to use these values to check
the worker's life state in time and space. Otherwise the process_id will
fall back on the ppid of the process (on the 'host' it's running on).
parent d72e9cf8
......@@ -77,6 +77,11 @@ if($url) {
my $queen = $DBA->get_Queen();
my $lsb_jobid = $ENV{'LSB_JOBID'};
my $lsb_jobindex = $ENV{'LSB_JOBINDEX'};
$self->{'process_id'} = "$lsb_jobid\[$lsb_jobindex\]" if(defined($lsb_jobid) and defined($lsb_jobindex));
print("pid = ", $self->{'process_id'}, "\n") if($self->{'process_id'});
if($self->{'logic_name'}) {
my $analysis = $queen->db->get_AnalysisAdaptor->fetch_by_logic_name($self->{'logic_name'});
$self->{'analysis_id'} = $analysis->dbID if($analysis);
......@@ -84,7 +89,8 @@ if($self->{'logic_name'}) {
my $worker = $queen->create_new_worker(
-analysis_id => $self->{'analysis_id'},
-beekeeper => $self->{'beekeeper'}
-beekeeper => $self->{'beekeeper'},
-process_id => $self->{'process_id'}
);
unless($worker) {
Bio::EnsEMBL::Hive::URLFactory->cleanup;
......@@ -146,6 +152,7 @@ sub usage {
print " -lifespan <num> : number of minutes this worker is allowed to run\n";
print " -outdir <path> : directory where stdout/stderr is redirected\n";
print " -bk <string> : beekeeper identifier\n";
print " -pid <string> : externally set process_id descriptor (e.g. lsf job_id, array_id)\n";
print "runWorker.pl v1.1\n";
exit(1);
......
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