--- source-trees/gt2-cvs/gram/jobmanager/setup/condor/condor.ine 2008-05-01 15:20:20.084000000 -0500 +++ source-trees/gt2-cvs/gram/jobmanager/setup/condor/condor.in 2008-05-01 15:22:17.868000000 -0500 @@ -312,6 +312,9 @@ print SCRIPT_FILE "Input = " . $description->stdin() . "\n"; print SCRIPT_FILE "Log = " . $self->{condor_logfile} . "\n"; print SCRIPT_FILE "log_xml = True\n"; +# Patched by the VDT + print SCRIPT_FILE "+GratiaJobOrigin=\"GRAM\"\n"; +# End VDT patch print SCRIPT_FILE "#Extra attributes specified by client\n"; print SCRIPT_FILE "$submit_attrs_string\n"; @@ -504,15 +507,22 @@ if $description->stdout() ne ''; $self->nfssync( $description->stderr(), 0 ) if $description->stderr() ne ''; - if ( ${self}->{individual_condor_log} ) { - unlink($self->{condor_logfile}); - } + + # Should we really delete a file that we have not + # been able to read. This leaves room for a race + # condition So the following code is commented out: + + #if ( ${self}->{individual_condor_log} ) { + # $self->log_to_gratia(); + # unlink($self->{condor_logfile}); + #} return { JOB_STATE => Globus::GRAM::JobState::DONE }; } if($num_abort > 0) { if ( ${self}->{individual_condor_log} ) { + $self->log_to_gratia(); unlink($self->{condor_logfile}); } $state = Globus::GRAM::JobState::FAILED; @@ -525,6 +535,7 @@ if $description->stderr() ne ''; if ( ${self}->{individual_condor_log} ) { + $self->log_to_gratia(); unlink($self->{condor_logfile}); } $state = Globus::GRAM::JobState::DONE; @@ -579,4 +590,39 @@ } } +# Patched by the VDT +sub log_to_gratia +{ + my $self = shift; + my $log_filename = $self->{condor_logfile}; + + # Select the gratia location + my $env = "$ENV{VDT_LOCATION}"; + if ( "x$env" eq "x" ) { + $env = "$ENV{GLOBUS_LOCATION}/.."; + } + if ( "x$env" eq "x" ) { + $env = "/var/tmp"; + } + my $log_dir = "$env/gratia/var/data/"; + + if ( -d $log_dir ) { + # For now assume that the existence of the directory means that + # accounting is enabled. + if ( -r $log_filename ) { + $self->log("Logging for accounting purpose the file $log_filename into $log_dir"); + @args = ("cp", "$log_filename" , "$log_dir" ); + system(@args) == 0 or $self->log("Error: system @args failed: $?"); + } else { + if ( ! -e $log_filename ) { + $self->log("Logging for accounting purpose failed: $log_filename does not exist"); + } else { + $self->log("Logging for accounting purpose failed: can not read the file $log_filename"); + } + return 0; # should return a proper Globus failure code. + } + } + return 1; # Should return a proper Globus success code +} + 1;