HTCondor Project List Archives



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Condor-devel] code review requested: the results of hte post script



Hello Derek:

I added support for getting the results of the job postscript into
the job ad. That seems preferable to having to use Chirp to poke things 
into the job ad. 

Please review the following diff, and consider applying it. If it's easier
for you, it's already applied to

/p/condor/workspaces/epaulson.1/V67-postscript

I'll consult with Karen to write better documentation, I just wanted to
get something in all of the places it will need to appear.

-Erik

Index: condor_includes/condor_attributes.h
===================================================================
RCS file: /p/condor/repository/CONDOR_SRC/src/condor_includes/condor_attributes.h,v
retrieving revision 1.59.8.51.6.22.4.45
diff -r1.59.8.51.6.22.4.45 condor_attributes.h
222a223
> const char ATTR_JOB_POST_CMD             [] = "PostCmd";
Index: condor_schedd.V6/qmgr_job_updater.C
===================================================================
RCS file: /p/condor/repository/CONDOR_SRC/src/condor_schedd.V6/Attic/qmgr_job_updater.C,v
retrieving revision 1.1.4.1
diff -r1.1.4.1 qmgr_job_updater.C
133a134,137
> 	terminate_job_queue_attrs->insert( ATTR_POST_ON_EXIT_BY_SIGNAL );
> 	terminate_job_queue_attrs->insert( ATTR_POST_ON_EXIT_SIGNAL );
> 	terminate_job_queue_attrs->insert( ATTR_POST_ON_EXIT_CODE );
> 	terminate_job_queue_attrs->insert( ATTR_POST_EXIT_REASON );
Index: condor_shadow.V6.1/remoteresource.C
===================================================================
RCS file: /p/condor/repository/CONDOR_SRC/src/condor_shadow.V6.1/remoteresource.C,v
retrieving revision 1.6.10.28.38.12
diff -r1.6.10.28.38.12 remoteresource.C
880a881,909
> 	if( update_ad->LookupBool(ATTR_POST_ON_EXIT_BY_SIGNAL, int_value) ) {
> 		if( int_value ) {
> 			sprintf( tmp, "%s=TRUE", ATTR_POST_ON_EXIT_BY_SIGNAL );
> 			exited_by_signal = true;
> 		} else {
> 			sprintf( tmp, "%s=FALSE", ATTR_POST_ON_EXIT_BY_SIGNAL );
> 			exited_by_signal = false;
> 		}
> 		jobAd->Insert( tmp );
> 	}
> 
> 	if( update_ad->LookupInteger(ATTR_POST_ON_EXIT_SIGNAL, int_value) ) {
> 		sprintf( tmp, "%s=%d", ATTR_POST_ON_EXIT_SIGNAL, int_value );
> 		exit_value = int_value;
> 		jobAd->Insert( tmp );
> 	}
> 
> 	if( update_ad->LookupInteger(ATTR_POST_ON_EXIT_CODE, int_value) ) {
> 		dprintf(D_ALWAYS, "Found an exit code!\n");
> 		sprintf( tmp, "%s=%d", ATTR_POST_ON_EXIT_CODE, int_value );
> 		exit_value = int_value;
> 		jobAd->Insert( tmp );
> 	}
> 
> 	if( update_ad->LookupString(ATTR_POST_EXIT_REASON,string_value) ) {
> 		sprintf( tmp, "%s=\"%s\"", ATTR_POST_EXIT_REASON, string_value );
> 		jobAd->Insert( tmp );
> 	}
> 
Index: condor_starter.V6.1/jic_shadow.C
===================================================================
RCS file: /p/condor/repository/CONDOR_SRC/src/condor_starter.V6.1/jic_shadow.C,v
retrieving revision 1.1.6.9.4.17
diff -r1.1.6.9.4.17 jic_shadow.C
573a574
> 	Starter->publishPostScriptUpdateAd( &ad );
Index: condor_submit.V6/submit.C
===================================================================
RCS file: /p/condor/repository/CONDOR_SRC/src/condor_submit.V6/submit.C,v
retrieving revision 1.123.8.60.4.38.4.80
diff -r1.123.8.60.4.38.4.80 submit.C
186a187
> char	*PostCmd		= "post_cmd";
2954a2956,2967
> SetPostCmd()
> {
> 	char* name = condor_param( PostCmd, ATTR_JOB_POST_CMD );
> 	if( name ) {
> 		(void) sprintf( buffer, "%s = \"%s\"", ATTR_JOB_POST_CMD, name );
> 		InsertJobExpr( buffer );
> 		free( name );
> 	}
> }
> 
> 
> void
4793a4807
> 		SetPostCmd();
Index: man-pages/condor_submit.tex
===================================================================
RCS file: /p/condor/repository/CONDOR_SRC/doc/man-pages/condor_submit.tex,v
retrieving revision 1.32.4.31.4.18.4.40
diff -r1.32.4.31.4.18.4.40 condor_submit.tex
714a715,730
> %% post_cmd
> %%%%%%%%%%%%%%%%%%%
> 
> \item[post\_cmd = $<$name$>$]
> \index{submit commands!post\_cmd}
> The name of the script to run after the job completes. 
> This script must be present on the machine where the job ran. 
> It will run as the same user that the job ran as, and in the same directory
> as the job initially started in.
> If the post script exits via a signal or with the regular exit code 
> the results will appear in the job ad with all of the same rules as the job.
> If it is not present, no post script for the job will be run.
> 
>  
> 
> %%%%%%%%%%%%%%%%%%%
Index: user-man/jobad.tex
===================================================================
RCS file: /p/condor/repository/CONDOR_SRC/doc/user-man/jobad.tex,v
retrieving revision 1.5.4.1.18.6.6.10
diff -r1.5.4.1.18.6.6.10 jobad.tex
259a260,287
> %%% ClassAd attribute: PostCmd
> \index{ClassAd job attribute!PostCmd}
> \item[\AdAttr{PostCmd}] : The name of the script to be executed when the job
> completes.
> It will run on the executing resource, as the same user that the job ran as.
> 
> %%% ClassAd attribute: PostExitBySignal
> \index{ClassAd job attribute!PostExitBySignal}
> \item[\AdAttr{PostExitBySignal}] : An attribute that is \Expr{True}
> when the post script of a user job exits via a signal and \Expr{False} 
> otherwise.
> It is available for use 
> in all universes except the grid and standard universes.
> 
> %%% ClassAd attribute: PostExitCode
> \index{ClassAd job attribute!PostExitCode}
> \item[\AdAttr{PostExitCode}] : When the post script of a  user job exits by means other than a signal,
> this is the exit return code of the post script.
> It is available for use 
> in all universes except the grid and standard universes.
> 
> %%% ClassAd attribute: PostExitSignal
> \index{ClassAd job attribute!PostExitSignal}
> \item[\AdAttr{PostExitSignal}] : When the post script of a user job exits by means of an unhandled 
> signal, this attribute takes on the numeric value of the signal.
> It is available for use 
> in all universes except the grid and standard universes.
> 
Index: version-history/6-7.history.tex
===================================================================
RCS file: /p/condor/repository/CONDOR_SRC/doc/version-history/Attic/6-7.history.tex,v
retrieving revision 1.1.2.291
diff -r1.1.2.291 6-7.history.tex
1c1
< %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
---
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
66a67,72
> \item Added support for running a script on an execute node after the
> job completes. The \SubmitCmd{post\_cmd} submit file option will run
> as the same user that the job ran on, in the same directory the job ran
> in. The exit status of the post script is available in the job classad
> for use on\_exit\_remove expressions.
>