-
Notifications
You must be signed in to change notification settings - Fork 2
/
Run_Condor.pm
executable file
·69 lines (47 loc) · 1.79 KB
/
Run_Condor.pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/local/bin/perl
package main;
our $DEBUG;
## simple interface to the HTCRequest module
package Run_Condor;
# to use condor
#use lib ("/home/condor/lib");
# To use SGE
use lib qw(/home/sgeworker/lib);
use TIGR::HTCRequest;
use strict;
use Data::Dumper;
sub launch_condor_job {
## simplest thing to do is to write a perl script which does all the hard work, and present this perl script name as the cmd parameter here, in cases where parameter parsing is a problem.
my ($workdir, $cmd, $parameter_list_aref, $inputFile_param_opt, $inputFiles_list_aref) = @_;
my $request = TIGR::HTCRequest->new(group => "BHaas-EukAnnot",
initialdir => $workdir,
opsys=>"Linux");
$request->set_command($cmd);
foreach my $param (@$parameter_list_aref) {
$request->add_param($param);
}
$request->add_param({key => "$inputFile_param_opt \$(Name)", value => $inputFiles_list_aref, type => "ARRAY"});
$request->set_output("\$(Name).stdout");
$request->set_error("\$(Name).stderr");
$request->set_getenv(1);
$request->length('long');
if($DEBUG) {
my $xx = $request->to_xml();
print $xx;
}
my $id = $request->submit();
print "Request id was $id \nDirectory: $workdir\n\n";
$request->wait_for_request();
open (my $log_fh, ">search.$$.log") or die $!;
print $log_fh Dumper($request->get_tasks());
close $log_fh;
my $message = $request->get_message();
if($request->get_state() eq "FAILURE") {
print " Condor failed: $message \n";
return (0);
} else {
print " Request finished with state " . $request->get_state() . " and $message \n";
return(1);
}
}
1; #EOM