mirror of
https://github.com/ohwgiles/laminar.git
synced 2024-10-27 20:34:20 +00:00
resolves #18: don't error out when rundir already exists
This commit is contained in:
parent
07c024e6ed
commit
28a939316c
@ -568,11 +568,12 @@ void Laminar::assignNewJobs() {
|
|||||||
std::shared_ptr<Run> run = *it;
|
std::shared_ptr<Run> run = *it;
|
||||||
if(nodeCanQueue(node, *run)) {
|
if(nodeCanQueue(node, *run)) {
|
||||||
fs::path cfgDir = fs::path(homeDir)/"cfg";
|
fs::path cfgDir = fs::path(homeDir)/"cfg";
|
||||||
|
boost::system::error_code err;
|
||||||
|
|
||||||
// create a workspace for this job if it doesn't exist
|
// create a workspace for this job if it doesn't exist
|
||||||
fs::path ws = fs::path(homeDir)/"run"/run->name/"workspace";
|
fs::path ws = fs::path(homeDir)/"run"/run->name/"workspace";
|
||||||
if(!fs::exists(ws)) {
|
if(!fs::exists(ws)) {
|
||||||
if(!fs::create_directories(ws)) {
|
if(!fs::create_directories(ws, err)) {
|
||||||
LLOG(ERROR, "Could not create job workspace", run->name);
|
LLOG(ERROR, "Could not create job workspace", run->name);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -584,7 +585,16 @@ void Laminar::assignNewJobs() {
|
|||||||
int buildNum = buildNums[run->name] + 1;
|
int buildNum = buildNums[run->name] + 1;
|
||||||
// create the run directory
|
// create the run directory
|
||||||
fs::path rd = fs::path(homeDir)/"run"/run->name/std::to_string(buildNum);
|
fs::path rd = fs::path(homeDir)/"run"/run->name/std::to_string(buildNum);
|
||||||
if(!fs::create_directory(rd)) {
|
bool createWorkdir = true;
|
||||||
|
if(fs::is_directory(rd)) {
|
||||||
|
LLOG(WARNING, "Working directory already exists, removing", rd.string());
|
||||||
|
fs::remove_all(rd, err);
|
||||||
|
if(err) {
|
||||||
|
LLOG(WARNING, "Failed to remove working directory", err.message());
|
||||||
|
createWorkdir = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(createWorkdir && !fs::create_directory(rd, err)) {
|
||||||
LLOG(ERROR, "Could not create working directory", rd.string());
|
LLOG(ERROR, "Could not create working directory", rd.string());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user