Commit 2b994c7b authored by Leo Gordon's avatar Leo Gordon
Browse files

new script for running standalone jobs

parent bccf3990
#!/usr/bin/env perl
use strict;
use warnings;
use Getopt::Long qw(:config pass_through);
use Bio::EnsEMBL::Registry;
use Bio::EnsEMBL::Hive::Process;
use Bio::EnsEMBL::Hive::AnalysisJob;
use Bio::EnsEMBL::Hive::Utils ('script_usage', 'load_file_or_module', 'parse_cmdline_options', 'stringify');
my ($reg_conf, $help, $debug, $no_write);
my $module_or_file = shift @ARGV or script_usage();
'help' => \$help,
'debug=i' => \$debug,
'reg_conf|regfile=s' => \$reg_conf,
'no_write|nowrite' => \$no_write,
if ($help or !$module_or_file) {
my $runnable_module = load_file_or_module( $module_or_file );
if($reg_conf) {
my $process = $runnable_module->new();
my $job = Bio::EnsEMBL::Hive::AnalysisJob->new();
my ($param_hash, $param_list) = parse_cmdline_options();
$job->param_init( 1, $process->param_defaults(), $param_hash );
my $input_id = stringify($param_hash);
$job->input_id( $input_id );
warn "\nRunning '$runnable_module' with '$input_id' :\n";
if($debug) {
# job's life cycle:
warn "\nFETCH_INPUT:\n";
warn "\nRUN:\n";
unless($no_write) {
warn "\nWRITE_OUTPUT:\n";
warn "\nDONE.\n";
=head1 NAME
=head1 DESCRIPTION is an eHive component script that
1. takes in a RunnableDB module,
2. creates a standalone job outside an eHive database by initializing parameters from command line arguments
3. and runs that job outside the database.
Naturally, only certain RunnableDB modules can be run using this script, and some database-related functionality will be lost.
# Just run a job with default parameters: Bio::EnsEMBL::Hive::RunnableDB::FailureTest
# Run a job and re-define some of the default parameters: Bio::EnsEMBL::Hive::RunnableDB::FailureTest -time_RUN=2 -time_WRITE_OUTPUT=3 -state=WRITE_OUTPUT -value=2 Bio::EnsEMBL::Hive::RunnableDB::SystemCmd -cmd 'ls -l'
# Run a job with given parameters, but skip the write_output() step: Bio::EnsEMBL::Hive::RunnableDB::FailureTest -no_write -time_RUN=2 -time_WRITE_OUTPUT=3 -state=WRITE_OUTPUT -value=2
-help : print this help
-debug <level> : turn on debug messages at <level>
-no_write : skip the execution of write_output() step this time
NB: all other options will be passed to the runnable (leading dashes removed) and will constitute the parameters for the job.
=head1 CONTACT
Please contact mailing list with questions/suggestions.
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