23 |
|
|
24 |
@ISA = qw(Globus::GRAM::JobManager); |
@ISA = qw(Globus::GRAM::JobManager); |
25 |
|
|
26 |
my ($mpirun, $mpiexec, $qsub, $qstat, $qdel, $cluster, $cpu_per_node, $remote_shell); |
my ($mpirun, $mpiexec, $qsub, $qstat, $qdel, $cluster, $cpu_per_node, $remote_shell, $vomsinfo); |
27 |
|
|
28 |
BEGIN |
BEGIN |
29 |
{ |
{ |
57 |
$cpu_per_node = $config->get_attribute('cpu_per_node') || 1; |
$cpu_per_node = $config->get_attribute('cpu_per_node') || 1; |
58 |
$remote_shell = $config->get_attribute('remote_shell') || undef; |
$remote_shell = $config->get_attribute('remote_shell') || undef; |
59 |
$softenv_dir = $config->get_attribute('softenv_dir') || ''; |
$softenv_dir = $config->get_attribute('softenv_dir') || ''; |
60 |
|
$vomsinfo = $config->get_attribute('vomsinfo') || undef; |
61 |
} |
} |
62 |
|
|
63 |
sub myceil ($) |
sub myceil ($) |
388 |
|
|
389 |
# Unset any variable whose value contains a comma, |
# Unset any variable whose value contains a comma, |
390 |
# because OpenPBS cannot handle those. EDG bug 1208. |
# because OpenPBS cannot handle those. EDG bug 1208. |
391 |
|
push(@new_env, $tuple->[0] . '="' . $tuple->[1] . '"') |
392 |
push(@new_env, $tuple->[0] . '="' . $tuple->[1] . '"') unless $tuple->[1] =~ /,/; |
unless $tuple->[1] =~ /,/; |
393 |
|
|
394 |
$tuple->[0] =~ s/\\/\\\\/g; |
$tuple->[0] =~ s/\\/\\\\/g; |
395 |
$tuple->[0] =~ s/\$/\\\$/g; |
$tuple->[0] =~ s/\$/\\\$/g; |
404 |
$rsh_env .= $tuple->[0] . '="' . $tuple->[1] . "\";\n" |
$rsh_env .= $tuple->[0] . '="' . $tuple->[1] . "\";\n" |
405 |
. 'export ' . $tuple->[0] . ";\n"; |
. 'export ' . $tuple->[0] . ";\n"; |
406 |
|
|
|
# preserve GRID_ID, GATEKEEPER_PEER, and others locally |
|
|
if ( $tuple->[0] =~ /^GRID_ID|GATEKEEPER_PEER|GATEKEEPER_JM_ID/ ) { |
|
|
$ENV{$tuple->[0]} = $tuple->[1]; |
|
|
} |
|
407 |
} |
} |
408 |
|
|
409 |
############################################################################### |
########################################################################## |
410 |
# Extract VO name for later use in variable definition |
# Extract accounting and VO data name for later use |
411 |
############################################################################### |
########################################################################## |
412 |
my $proxylocation; |
my ($proxylocation, $voname, $gridid, $peeraddr, $jmid); |
|
my $voname; |
|
413 |
my @fqans; |
my @fqans; |
|
my $vpinfo = '/usr/bin/voms-proxy-info'; |
|
414 |
foreach my $tuple ($description->environment()) { |
foreach my $tuple ($description->environment()) { |
415 |
$proxylocation = $tuple->[1] if $tuple->[0] eq "X509_USER_PROXY"; |
$proxylocation = $tuple->[1] if $tuple->[0] eq "X509_USER_PROXY"; |
416 |
|
$gridid = $tuple->[1] if $tuple->[0] eq "GRID_ID"; |
417 |
|
$peeraddr = $tuple->[1] if $tuple->[0] eq "GATEKEEPER_PEER"; |
418 |
|
$jmid = $tuple->[1] if $tuple->[0] eq "GATEKEEPER_JM_ID"; |
419 |
} |
} |
420 |
if ( defined ($proxylocation) ) { |
if ( defined ($proxylocation) and defined ($vomsinfo) and $vomsinfo ) { |
421 |
print JOB '# Inspecting proxy '.$proxylocation."\n"; |
print JOB '# Inspecting proxy '.$proxylocation."\n"; |
422 |
|
|
423 |
[ -x $vpinfo ] and do { |
if ( -x $vomsinfo ) { |
424 |
$voname=`$vpinfo -file "$proxylocation" -vo 2>/dev/null`; |
chomp($voname=`$vomsinfo -file "$proxylocation" -vo 2>/dev/null`); |
425 |
$voname="dteam"; |
@fqans = map { chomp($_); $_; } |
426 |
chomp($voname); |
`$vomsinfo -file "$proxylocation" -fqan 2>/dev/null`; |
427 |
|
|
428 |
|
### EXAMPLE for as long as long proxies kill the jobmanager |
429 |
|
$voname="dteam"; |
430 |
|
@fqans = ( '/dteam/Role=NULL/Capability=NULL' ); |
431 |
|
|
432 |
if ( $voname =~ /[a-zA-Z][\w\d\.]*/ ) { |
if ( $voname =~ /[a-zA-Z][\w\d\.]*/ ) { |
433 |
print JOB "# VO name from proxy is $voname\n"; |
print JOB "# VO name from proxy is $voname\n"; |
434 |
$rsh_env .= 'VONAME="' . $voname . "\";\n" |
$rsh_env .= 'VONAME="' . $voname . "\";\n" |
437 |
} else { |
} else { |
438 |
print JOB "# VO name $voname from proxy is NOT valid\n"; |
print JOB "# VO name $voname from proxy is NOT valid\n"; |
439 |
} |
} |
|
@fqans = map { chomp($_); $_; } |
|
|
`$vpinfo -file "$proxylocation" -fqan 2>/dev/null`; |
|
440 |
if ( $#fqans >= 0 ) { |
if ( $#fqans >= 0 ) { |
441 |
print JOB "# FQAN order in proxy:\n"; |
print JOB "# FQAN order in proxy:\n"; |
442 |
foreach my $qfan ( @fqans ) { print JOB "# $fqan\n"; } |
foreach my $qfan ( @fqans ) { print JOB "# $fqan\n"; } |
443 |
}; |
}; |
444 |
}; |
} else { |
445 |
|
print JOB "# $vomsinfo not available, ignored\n"; |
446 |
|
} |
447 |
} else { |
} else { |
448 |
print JOB "# Proxy location undefined, VO not set\n"; |
print JOB "# Proxy location undefined or no vomsinfo requested\n"; |
|
} |
|
|
foreach my $e ( keys %ENV ) { |
|
|
print JOB "# SYSTEM ENV $e = ".$ENV{$e}."\n"; |
|
449 |
} |
} |
450 |
############################################################################### |
########################################################################## |
451 |
|
|
452 |
|
|
453 |
$rc = print JOB "$rsh_env\n" |
$rc = print JOB "$rsh_env\n" |
795 |
# produce CREAM-like accounting record in syslog |
# produce CREAM-like accounting record in syslog |
796 |
my $todaylocal = POSIX::strftime "%Y%m%d", localtime; |
my $todaylocal = POSIX::strftime "%Y%m%d", localtime; |
797 |
my $accountinglog = "jobmanagement accounting;"; |
my $accountinglog = "jobmanagement accounting;"; |
798 |
$accountinglog .= " REMOTE_REQUEST_ADDRESS=".$ENV{"GATEKEEPER_PEER"}.";"; |
$accountinglog .= " REMOTE_REQUEST_ADDRESS=$peeraddr;" |
799 |
$accountinglog .= " USER_DN=".$ENV{"GRID_ID"}.";"; |
if defined $peeraddr; |
800 |
|
$accountinglog .= " USER_DN=$gridid;" if defined $gridid; |
801 |
if ( $#fqans >= 0 ) { |
if ( $#fqans >= 0 ) { |
802 |
$accountinglog .= " USER_FQAN={"; |
$accountinglog .= " USER_FQAN={"; |
803 |
foreach my $fqan ( @fqans ) { |
foreach my $fqan ( @fqans ) { |
805 |
} |
} |
806 |
$accountinglog .= " };"; |
$accountinglog .= " };"; |
807 |
} |
} |
808 |
$accountinglog .= " USER_VO=$voname;"; |
$accountinglog .= " USER_VO=$voname;" if defined $voname; |
809 |
$accountinglog .= " JOB_REPOSITORY_ID=".$ENV{"JOB_REPOSITORY_ID"}.";" |
$accountinglog .= " JOB_REPOSITORY_ID=$jmid;" if defined $jmid; |
|
if defined $ENV{"JOB_REPOSITORY_ID"}; |
|
810 |
$accountinglog .= " CMD_NAME=JOB_START;"; |
$accountinglog .= " CMD_NAME=JOB_START;"; |
811 |
$accountinglog .= " uid=".getpwuid($<).";"; |
$accountinglog .= " uid=".getpwuid($<).";"; |
812 |
$accountinglog .= " gid=".getgrgid($().";"; |
$accountinglog .= " gid=".getgrgid($().";"; |
837 |
# ##################################################################### |
# ##################################################################### |
838 |
# error log in syslog |
# error log in syslog |
839 |
system("logger -p daemon.err -t jobmanager-pbs -i -- ". |
system("logger -p daemon.err -t jobmanager-pbs -i -- ". |
840 |
"\"qsub error (".getpwuid($<).":".getgrgid($().")". |
"\"qsub error (".getpwuid($<).":".getgrgid($().") ". |
841 |
" $pbs_job_script_name: $qsubstatus\""); |
" $pbs_job_script_name: $qsubstatus\""); |
842 |
# ##################################################################### |
# ##################################################################### |
843 |
|
|