jobInfo: Write jobInfo files into the case/jobInfo directory

With the writeJobInfo option in OpenFOAM-dev/etc/controlDict::InfoSwitches set
to 1 each OpenFOAM executable writes a <executable>.<pid> file containing the
job summary into the <case>/jobInfo directory, e.g. after running the
tutorials/incompressible/pisoFoam/RAS/cavity tutorials

tutorials/incompressible/pisoFoam/RAS/cavity/jobInfo contains
blockMesh.20169  pisoFoam.20170
This commit is contained in:
Henry Weller
2018-01-21 12:22:30 +00:00
parent 672d3058ea
commit 907bb58e9f
4 changed files with 22 additions and 13 deletions

View File

@ -2,7 +2,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation # \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
@ -56,6 +56,7 @@ cleanCase()
cleanDynamicCode cleanDynamicCode
rm -rf processor* > /dev/null 2>&1 rm -rf processor* > /dev/null 2>&1
rm -rf jobInfo > /dev/null 2>&1
rm -rf postProcessing > /dev/null 2>&1 rm -rf postProcessing > /dev/null 2>&1
rm -rf TDAC > /dev/null 2>&1 rm -rf TDAC > /dev/null 2>&1
rm -rf probes* > /dev/null 2>&1 rm -rf probes* > /dev/null 2>&1

View File

@ -895,7 +895,7 @@ void Foam::argList::parse
{ {
jobInfo_.add("roots", roots); jobInfo_.add("roots", roots);
} }
jobInfo_.write(rootPath_/globalCase_); jobInfo_.write(executable_, rootPath_/globalCase_);
// Switch on signal trapping. We have to wait until after Pstream::init // Switch on signal trapping. We have to wait until after Pstream::init
// since this sets up its own ones. // since this sets up its own ones.

View File

@ -90,13 +90,6 @@ Foam::jobInfo::jobInfo()
writeJobInfo = true; writeJobInfo = true;
} }
else if (writeJobInfo)
{
string jobFile = name() + '.' + Foam::name(pid());
runningJobPath_ = jobFile;
finishedJobPath_ = jobFile;
}
} }
constructed = true; constructed = true;
@ -139,14 +132,29 @@ bool Foam::jobInfo::write(Ostream& os) const
} }
void Foam::jobInfo::write(const fileName& casePath) const void Foam::jobInfo::write
(
const word& executable,
const fileName& casePath
) const
{ {
if (writeJobInfo && Pstream::master()) if (writeJobInfo && Pstream::master())
{ {
if (!writeJobControl) if (!writeJobControl)
{ {
runningJobPath_ = casePath/runningJobPath_; const fileName jobInfoPath(casePath/"jobInfo");
finishedJobPath_ = casePath/finishedJobPath_;
if (!isDir(jobInfoPath) && !mkDir(jobInfoPath))
{
FatalErrorInFunction
<< "Cannot make jobInfo directory " << jobInfoPath
<< Foam::exit(FatalError);
}
const word jobFile = executable + '.' + Foam::name(pid());
runningJobPath_ = jobInfoPath/jobFile;
finishedJobPath_ = jobInfoPath/jobFile;
} }
if (!write(OFstream(runningJobPath_)())) if (!write(OFstream(runningJobPath_)()))

View File

@ -86,7 +86,7 @@ public:
// Member Functions // Member Functions
void write(const fileName& casePath) const; void write(const word& executable, const fileName& casePath) const;
void end(); void end();