39#ifndef FOAM_RESOURCE_USER_CONFIG_DIRNAME
40#define FOAM_RESOURCE_USER_CONFIG_DIRNAME ".OpenFOAM"
42 #warning FOAM_RESOURCE_USER_CONFIG_DIRNAME was undefined (now ".OpenFOAM")
65 <<
"WARNING: no JobInfo directory: " << dir <<
nl
66 <<
" disabling JobInfo" <<
nl;
119void Foam::JobInfo::jobEnding()
121 if (!running_.empty())
135void Foam::JobInfo::jobEnding(
const word& terminationType)
137 if (writeJobInfo && !finished_.empty())
139 add(
"cpuTime", cpuTime_.elapsedCpuTime());
143 if (!terminationType.empty() && !
found(
"termination"))
145 add(
"termination", terminationType);
149 OFstream
os(finished_);
153 <<
"WARNING: could not write JobInfo file: "
171 <<
"WARNING: JobInfo was already constructed. "
172 "Should be a singleton!!" <<
nl;
184 running_ = jobDir/
"runningJobs"/jobFile;
185 finished_ = jobDir/
"finishedJobs"/jobFile;
216 if (writeJobInfo && !running_.empty())
222 <<
"WARNING: could not write JobInfo file: "
#define FOAM_RESOURCE_USER_CONFIG_DIRNAME
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
bool good() const noexcept
True if next operation might succeed.
Helper class for recording information about run/finished jobs, acts like global singleton.
static void disable() noexcept
Disallow JobInfo by forcing writeJobInfo (InfoSwitch) off.
void exit()
Job end with "exit" termination.
void write() const
Write job info to its file in the "running" jobs directory.
JobInfo()
Default construct.
~JobInfo()
Destructor, relocates the job file from running to finished.
static void shutdown()
Simple shutdown (finalize) of JobInfo.
static bool writeJobInfo
Global value for writeJobInfo enabled.
void stop()
Job end with "normal" termination.
void abort()
Job end with "abort" termination.
void signalEnd()
Relocate job file from "running" to "finished" directory.
Output to file stream, using an OSstream.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
static std::string date()
static std::string clockTime()
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
const fileName & name() const noexcept
The dictionary name.
void writeEntries(Ostream &os, const bool extraNewLine=false) const
Write dictionary entries.
A class for handling file names.
splitCell * master() const
OBJstream os(runTime.globalPath()/outputName)
int infoSwitch(const char *name, const int deflt=0)
Lookup info switch or add default value.
bool rm(const fileName &file)
Remove a file (or its gz equivalent), returning true if successful.
string getEnv(const std::string &envName)
Get environment value for given envName.
bool mkDir(const fileName &pathName, mode_t mode=0777)
Make a directory and return an error if it could not be created.
string hostName()
Return the system's host name, as per hostname(1)
void add(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
static bool writeJobDict(Ostream &os, const dictionary &dict)
pid_t pid()
Return the PID of this process.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
bool mv(const fileName &src, const fileName &dst, const bool followLink=false)
Rename src to dst.
fileName home()
Return home directory path name for the current user.
static bool ensureJobDirExists(const fileName &dir)
bool isDir(const fileName &name, const bool followLink=true)
Does the name exist as a DIRECTORY in the file system?
constexpr char nl
The newline '\n' character (0x0a)