diff options
author | swhite <swhite@e5a5a894-0e4f-0410-be11-d22c8b0a171a> | 2006-04-28 14:49:57 +0000 |
---|---|---|
committer | swhite <swhite@e5a5a894-0e4f-0410-be11-d22c8b0a171a> | 2006-04-28 14:49:57 +0000 |
commit | 7d406fb1d985a294948f5cf191890ffe0e687c3b (patch) | |
tree | 0e12523f10f92da5527e148ac9c92051c07bf659 | |
parent | 50ac02734e80dc84326274e2a77bb03bf626e03a (diff) |
Two bug fixes
* make file only on the root node
* set file permission to 660 (ug+rw)
git-svn-id: http://svn.aei.mpg.de/numrel/AEIThorns/ManualTermination/trunk@4 e5a5a894-0e4f-0410-be11-d22c8b0a171a
-rw-r--r-- | doc/documentation.tex | 2 | ||||
-rw-r--r-- | src/ManualTerminationFile.c | 13 |
2 files changed, 11 insertions, 4 deletions
diff --git a/doc/documentation.tex b/doc/documentation.tex index 4efbd95..d27de47 100644 --- a/doc/documentation.tex +++ b/doc/documentation.tex @@ -83,7 +83,7 @@ ManualTermination::output_remtime_every_minutes=2 # how often to remind user The two modes, termination by wall time and termination from file, are meant to be independent and can be used together or separately. -The default file checked is +The default file checked is on the root node (the node of MPI rank 0) \texttt{/tmp//cactus\_terminate.\textit{job\_id}}, where by default, \texttt{\textit{job\_id}} is gotten from the \texttt{PBS\_JOBID} environment variable. If the environment variable diff --git a/src/ManualTerminationFile.c b/src/ManualTerminationFile.c index 7e10a38..c1c3be3 100644 --- a/src/ManualTerminationFile.c +++ b/src/ManualTerminationFile.c @@ -2,12 +2,15 @@ #include <stdlib.h> #include <string.h> #include <errno.h> +#include <sys/stat.h> #include "cctk.h" #include "cctk_Arguments.h" #include "cctk_Parameters.h" #include "cctk_Termination.h" - +/* The termination file only lives on the root node, so the scheduled + * functions here always check that they are on that node. + */ enum{ BUFLEN = 128 }; /* On first call, pass parameter terminate_filename. If it is null will construct file name in /tmp based on PBS_JOBID. @@ -46,13 +49,15 @@ int ManualTermination_Init (CCTK_ARGUMENTS) DECLARE_CCTK_ARGUMENTS; DECLARE_CCTK_PARAMETERS; - if (termination_from_file) + if (termination_from_file && CCTK_MyProc (cctkGH) == 0) { FILE *termfile = fopen (MT_get_terminate_filename (termination_file), "w"); if (termfile != NULL) { fprintf (termfile, "%d", 0); fclose (termfile); + chmod(MT_get_terminate_filename (NULL), + S_IRUSR|S_IRGRP|S_IWUSR|S_IWGRP); } else { @@ -107,7 +112,9 @@ int ManualTermination_Cleanup (CCTK_ARGUMENTS) { DECLARE_CCTK_PARAMETERS; - if (termination_from_file && MT_get_terminate_filename (NULL)) + if (termination_from_file + && CCTK_MyProc (cctkGH) == 0 + && MT_get_terminate_filename (NULL)) remove (MT_get_terminate_filename (NULL)); return 0; } |