Skip to content

Commit 56569a7

Browse files
andyclaude
andcommitted
Duplicate/Reset for Rerun: stop inheriting the previous run's properties
A duplicated calculation starts as an exact copy, and resetForRerun() then tidies it up -- removing the job log, resetting the state, and calling removeOutputFiles(). That takes away the raw output but NOT the properties parsed out of it, which live in their own collection. So a duplicate arrived carrying the parent's energies, geometry trace and orbitals, and offered them in the Properties menu as its own, before it had ever been run, with nothing to say they were inherited. The same applied to "Reset for Rerun" on a job that had run. resetForRerun() now removes the properties too. Evaluation order matters and is deliberate: && short-circuits, so removeProperties() is called before the expression rather than inside it, and still runs if removing the outputs fails. The input file is deliberately NOT removed. resetForRerun() already drops it when the target state is CREATED and keeps it for READY, which is what makes "Duplicate for Rerun" launchable straight away -- the deck is derived from the settings, so a duplicate that keeps its settings should keep it. Where that goes wrong is when the GENERATOR has changed rather than the settings, and File > Regenerate Input File is the answer to that. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFMUNbw2UpRPmgsqviAowb
1 parent b4bc889 commit 56569a7

2 files changed

Lines changed: 43 additions & 1 deletion

File tree

‎include/dsm/TaskJob.H‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,10 @@ class TaskJob : public Job,
133133

134134
virtual bool removeInputFiles();
135135
virtual bool removeOutputFiles();
136+
137+
/** Remove the extracted properties, leaving the calculation's
138+
settings alone. */
139+
virtual bool removeProperties();
136140
virtual bool putInputFile(const string& name, istream *istr);
137141
virtual bool putOutputFile(const string& name, istream *istr);
138142
virtual bool putAnyFile(const string& name, istream* istr);

‎src/dsm/edsiimpl/TaskJob.C‎

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -699,6 +699,34 @@ bool TaskJob::removeInputFiles()
699699
*
700700
* @return Returns true if all output files were removed, otherwise false.
701701
*/
702+
/**
703+
* Remove the properties extracted from a previous run.
704+
*
705+
* removeOutputFiles() takes away the raw output but NOT the properties
706+
* parsed out of it, which live in their own collection. For a
707+
* calculation about to be rerun -- and especially for a duplicate,
708+
* which starts life as an exact copy -- leaving them behind means the
709+
* Properties menu offers the PREVIOUS run's energies, geometries and
710+
* orbitals on a job that has not been run yet, with nothing to say they
711+
* are inherited.
712+
*/
713+
bool TaskJob::removeProperties()
714+
{
715+
bool ret = true;
716+
717+
try {
718+
getVDoc()->removeProperties();
719+
}
720+
catch (DavException& davException) {
721+
p_msgStack->add("UNABLE_TO_COMPLETE_REQUEST",
722+
davException.what());
723+
ret = false;
724+
}
725+
726+
return ret;
727+
}
728+
729+
702730
bool TaskJob::removeOutputFiles()
703731
{
704732
bool ret = true;
@@ -1818,7 +1846,17 @@ bool TaskJob::resetForRerun(const ResourceDescriptor::RUNSTATE& toState)
18181846
}
18191847
}
18201848

1821-
bool ret = setState(tostate) && removeOutputFiles();
1849+
// Properties as well as outputs. Without this a duplicated
1850+
// calculation carries the parent's extracted results -- energies,
1851+
// geometry trace, orbitals -- and presents them as its own before it
1852+
// has ever been run. "Duplicate should inherit nothing from the
1853+
// parent job beyond the settings."
1854+
//
1855+
// Evaluation order matters: && short-circuits, so removeProperties()
1856+
// is called first to guarantee it runs even if removing the outputs
1857+
// fails.
1858+
bool propsGone = removeProperties();
1859+
bool ret = setState(tostate) && removeOutputFiles() && propsGone;
18221860

18231861
// set rerun flag so calculation run directory files are removed
18241862
// if/when the job is launched

0 commit comments

Comments
 (0)