a Manager to handle the submission directory itself
More...
#include <SubmitDirManager.h>
a Manager to handle the submission directory itself
Definition at line 22 of file SubmitDirManager.h.
◆ doManagerStep()
do whatever needs to be done for the given submission step
- Guarantee
- basic
- Failures
- job configuration errors
driver errors
Implements EL::Detail::Manager.
Definition at line 68 of file SubmitDirManager.cxx.
78 if (
data.submitDir[0] !=
'/')
79 data.submitDir = gSystem->WorkingDirectory () + (
"/" +
data.submitDir);
82 const std::regex identityEndExpr {
"(/$)|(/\\.$)"};
83 while (std::regex_search (
data.submitDir,
match, identityEndExpr))
86 if (std::regex_search (
data.submitDir,
match, relativeEndExpr))
89 return ::StatusCode::FAILURE;
98 const std::regex identityExpr {
"(/\\./)|(//)|(^/\\.\\./)"};
99 while (std::regex_search (
data.submitDir,
match, identityExpr))
101 const std::regex relativeExpr {
"/[^/]+/\\.\\./"};
102 while (std::regex_search (
data.submitDir,
match, relativeExpr))
105 if (
data.submitDir.find (
"/pnfs/") == 0)
108 return ::StatusCode::FAILURE;
120 if (
mode ==
"no-clobber")
122 else if (
mode ==
"overwrite")
124 else if (
mode ==
"unique")
126 else if (
mode ==
"unique-link")
131 ANA_MSG_ERROR (
"known modes: no-clobber, overwrite, unique, unique-link");
132 return ::StatusCode::FAILURE;
140 ANA_MSG_ERROR (
"can't specify both an explicit submit-dir mode and optRemoveSubmitDir");
141 return ::StatusCode::FAILURE;
152 bool success {
false};
155 std::size_t
hash {0};
156 while (success ==
false && tries < 10)
160 switch (
data.submitDirMode)
172 if (gettimeofday (&tv,
nullptr) == -1 ||
173 localtime_r (&tv.tv_sec, &tvSplit) ==
nullptr)
177 return ::StatusCode::FAILURE;
179 const std::string uniqueDateFormat {
184 uniqueDateFormat.c_str(), &tvSplit);
187 boost::hash_combine (
hash, std::hash<pid_t>() (getpid()));
188 boost::hash_combine (
hash, std::hash<suseconds_t>() (tv.tv_usec));
189 std::size_t hash16 {
hash};
190 while (hash16 > 0xffff)
191 hash16 = (hash16&0xffff) ^ (hash16 >> 16);
214 const int myerrno {errno};
215 if (myerrno == EEXIST)
217 switch (
data.submitDirMode)
221 ANA_MSG_ERROR (
"change the name or remove file/directory already there");
222 return ::StatusCode::FAILURE;
228 return ::StatusCode::FAILURE;
231 gSystem->Exec ((
"rm -rf " +
submitDir).c_str());
241 reportErrno (myerrno);
243 return ::StatusCode::FAILURE;
251 switch (
data.submitDirMode)
261 if (unlink (
data.submitDir.c_str()) == -1 && errno != ENOENT)
265 return ::StatusCode::FAILURE;
269 if (symlink (
file.c_str(),
data.submitDir.c_str()) == -1)
273 return ::StatusCode::FAILURE;
282 ANA_MSG_ERROR (
"tried " << tries <<
" times to create directory and failed: " <<
data.submitDir);
284 return ::StatusCode::FAILURE;
293 return ::StatusCode::SUCCESS;
◆ getManagerOrder()
std::pair< Detail::ManagerOrder, std::string > EL::Detail::SubmitDirManager::getManagerOrder |
( |
| ) |
const |
|
overridevirtualnoexcept |
get the order/name of this manager
This is both used to identify the manager we are looking at, and to make sure they get executed in the right order. It is a mistake to load two managers that report the same order.
This is a pair of an enum that defines the absolute order of managers, and a string that identifies the stream that this manager belongs to. If this manager is not specific to a stream this should be the empty stream.
- Guarantee
- no-fail
Implements EL::Detail::Manager.
Definition at line 60 of file SubmitDirManager.cxx.
The documentation for this class was generated from the following files:
static const std::string optSubmitDirMode
the submit-dir mode (allowed values: "no-clobber", "overwrite", "unique", "unique-link")