--- source-trees/gt2-cvs/gram/jobmanager/setup/condor/condor.in 2006-11-10 13:17:31.000000000 -0600 +++ source-trees/gt2-cvs/gram/jobmanager/setup/condor/condor.in 2006-11-10 13:23:16.000000000 -0600 @@ -514,15 +514,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; @@ -535,6 +542,7 @@ if $description->stderr() ne ''; if ( ${self}->{individual_condor_log} ) { + $self->log_to_gratia(); unlink($self->{condor_logfile}); } $state = Globus::GRAM::JobState::DONE; @@ -585,4 +593,48 @@ } } +# Patched by the VDT +my $condor_version_number = 0; +sub log_to_gratia +{ + unless ($condor_version_number) { + my $condor_version_string = `condor_version 2>/dev/null`; + $condor_version_number = + join("", + map { m&^(\d+)&?sprintf("%03d", $1):"000" } + ($condor_version_string =~ m!^\$CondorVersion: ([^\.]+)\.([^\.]+)\.([^\.]+)!s)); + return 1 unless ($condor_version_number < 6009000); + } + 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;