diff options
author | schnetter <schnetter@83718e91-0e4f-0410-abf4-91180603181f> | 2007-05-24 02:00:22 +0000 |
---|---|---|
committer | schnetter <schnetter@83718e91-0e4f-0410-abf4-91180603181f> | 2007-05-24 02:00:22 +0000 |
commit | 5e81962213ef3462d74096cd82a69394bbd53688 (patch) | |
tree | f27c40032d06a3592a9776de3304c759925e2f92 /src/id.cc | |
parent | f0923ce63df941b7665eab963c2e36ac9f0194ed (diff) |
Make the parameter file name part of the job id.
Separate date and time elements in the job id by periods.
git-svn-id: http://svn.cactuscode.org/arrangements/CactusUtils/Formaline/trunk@123 83718e91-0e4f-0410-abf4-91180603181f
Diffstat (limited to 'src/id.cc')
-rw-r--r-- | src/id.cc | 31 |
1 files changed, 31 insertions, 0 deletions
@@ -1,3 +1,4 @@ +#include <cctype> #include <iomanip> #include <sstream> #include <string> @@ -62,6 +63,32 @@ namespace Formaline ostringstream job_idbuf; job_idbuf << "job-"; + char cparfilename [10000]; + CCTK_ParameterFilename (sizeof cparfilename, cparfilename); + string parfilename (cparfilename); + size_t const last_slash = parfilename.rfind ('/'); + if (last_slash < string::npos) { + parfilename.erase (0, last_slash + 1); + } + size_t const first_dot = parfilename.find ('.'); + parfilename.erase (first_dot); + { + string::iterator it = parfilename.begin(); + while (it != parfilename.end()) { + char const c = *it; + if (isalnum (c) or c == '+' or c == '-' or c == '.' or c == '_') { + // Allow character + ++ it; + } else { + // Remove character + it = parfilename.erase (it); + } + } + } + job_idbuf << parfilename; + + job_idbuf << "-"; + char run_host [1000]; Util_GetHostName (run_host, sizeof run_host); job_idbuf << run_host; @@ -81,11 +108,15 @@ namespace Formaline struct tm * const ptm = gmtime (& tim); job_idbuf << setfill ('0') << setw(4) << 1900 + ptm->tm_year + << "." << setw(2) << ptm->tm_mon + 1 + << "." << setw(2) << ptm->tm_mday << "-" << setw(2) << ptm->tm_hour + << "." << setw(2) << ptm->tm_min + << "." << setw(2) << ptm->tm_sec; job_idbuf << "-"; |