Skip to content
Snippets Groups Projects
Commit 4c1c9d2a authored by Samuel Jones's avatar Samuel Jones
Browse files

Merge branch '0_StopRecoveryReSavingSavedFiles' into 2345_GracefulHandlingOfGroupWorkspaces

parents 6d9f7046 929386cb
Branches 22031_phaseQuadGUI
No related tags found
No related merge requests found
......@@ -73,7 +73,69 @@ private:
std::string m_output;
std::string m_versionSpecificity;
bool m_timestampCommands;
bool m_ignoreGroups;
bool m_projectRecovery;
std::vector<std::string> m_algsToIgnore = {
"GroupWorkspaces",
"EnggSaveGSASIIFitResultsToHDF5",
"EnggSaveSinglePeakFitResultsToHDF5",
"ExampleSaveAscii",
"SANSSave",
"SaveANSTOAscii",
"SaveAscii",
"SaveBankScatteringAngles",
"SaveCSV",
"SaveCalFile",
"SaveCanSAS1D",
"SaveDaveGrp",
"SaveDetectorsGrouping",
"SaveDiffCal",
"SaveDiffFittingAscii",
"SaveDspacemap",
"SaveFITS",
"SaveFocusedXYE",
"SaveFullprofResolution",
"SaveGDA",
"SaveGEMMAUDParamFile",
"SaveGSASInstrumentFile",
"SaveGSS",
"SaveHKL",
"SaveILLCosmosAscii",
"SaveISISNexus",
"SaveIsawDetCal",
"SaveIsawPeaks",
"SaveIsawQvector",
"SaveIsawUB",
"SaveLauenorm",
"SaveMD",
"SaveMDWorkspaceToVTK",
"SaveMask",
"SaveNISTDAT",
"SaveNXSPE",
"SaveNXTomo",
"SaveNXcanSAS",
"SaveNexus",
"SaveNexusPD",
"SaveNexusProcessed",
"SaveOpenGenieAscii",
"SavePAR",
"SavePDFGui",
"SavePHX",
"SaveParameterFile",
"SavePlot1D",
"SavePlot1DAsJson",
"SaveRKH",
"SaveReflCustomAscii",
"SaveReflThreeColumnAscii",
"SaveReflections",
"SaveReflectometryAscii",
"SaveSESANS",
"SaveSPE",
"SaveTBL",
"SaveToSNSHistogramNexus",
"SaveVTK",
"SaveVulcanGSS",
"SaveYDA",
"SaveZODS"};
};
} // namespace API
......
......@@ -31,11 +31,11 @@ const std::string COMMENT_ALG = "Comment";
ScriptBuilder::ScriptBuilder(boost::shared_ptr<HistoryView> view,
std::string versionSpecificity,
bool appendTimestamp, bool ignoreGroupWorkspaces)
bool appendTimestamp, bool projectRecovery)
: m_historyItems(view->getAlgorithmsList()), m_output(),
m_versionSpecificity(versionSpecificity),
m_timestampCommands(appendTimestamp),
m_ignoreGroups(ignoreGroupWorkspaces) {}
m_timestampCommands(appendTimestamp), m_projectRecovery(projectRecovery) {
}
/**
* Build a python script for each algorithm included in the history view.
......@@ -88,10 +88,12 @@ void ScriptBuilder::writeHistoryToStream(
}
} else {
// create the string for this algorithm
if (!m_ignoreGroups) {
if (!m_projectRecovery) {
createStringForAlg(os, algHistory);
}
if (m_ignoreGroups && algHistory->name() != "GroupWorkspaces") {
if (m_projectRecovery &&
!(std::find(m_algsToIgnore.begin(), m_algsToIgnore.end(),
algHistory->name()) != m_algsToIgnore.end())) {
createStringForAlg(os, algHistory);
}
}
......
......@@ -65,8 +65,8 @@ void GeneratePythonScript::init() {
boost::make_shared<StringListValidator>(saveVersions),
"When to specify which algorithm version was used by Mantid.");
declareProperty("IgnoreGroups", false,
"Whether or not groups need to be filtered for",
declareProperty("ProjectRecovery", false,
"Whether or not unneeded algorithms should be filtered for",
Direction::Input);
}
......@@ -79,7 +79,7 @@ void GeneratePythonScript::exec() {
const std::string endTime = getProperty("EndTimestamp");
const std::string saveVersions = getProperty("SpecifyAlgorithmVersions");
const bool appendTimestamp = getProperty("AppendTimestamp");
const bool removeGroupAlgorithms = getProperty("IgnoreGroups");
const bool projectRecovery = getProperty("ProjectRecovery");
// Get the algorithm histories of the workspace.
const WorkspaceHistory wsHistory = ws->getHistory();
......@@ -111,7 +111,7 @@ void GeneratePythonScript::exec() {
versionSpecificity = "all";
ScriptBuilder builder(view, versionSpecificity, appendTimestamp,
removeGroupAlgorithms);
projectRecovery);
std::string generatedScript;
generatedScript += "#########################################################"
"#############\n";
......
......@@ -127,7 +127,7 @@ public:
Mantid::API::AnalysisDataService::Instance().clear();
}
void test_workspace_group() {
void test_project_recovery_option() {
Mantid::Algorithms::CreateWorkspace creator;
creator.initialize();
creator.setPropertyValue("OutputWorkspace", "ws1");
......@@ -163,7 +163,7 @@ public:
TS_ASSERT_THROWS_NOTHING(
alg.setPropertyValue("Filename", "GeneratePythonScriptTest.py"));
TS_ASSERT_THROWS_NOTHING(alg.setPropertyValue("ScriptText", ""));
TS_ASSERT_THROWS_NOTHING(alg.setProperty("IgnoreGroups", true));
TS_ASSERT_THROWS_NOTHING(alg.setProperty("ProjectRecovery", true));
TS_ASSERT_THROWS_NOTHING(alg.execute(););
TS_ASSERT(alg.isExecuted());
......
......@@ -521,7 +521,7 @@ void ProjectRecovery::saveWsHistories(const Poco::Path &historyDestFolder) {
alg->setProperty("InputWorkspace", ws);
alg->setPropertyValue("Filename", destFilename.toString());
alg->setPropertyValue("StartTimestamp", startTime);
alg->setProperty("IgnoreGroups", true);
alg->setProperty("ProjectRecovery", true);
alg->execute();
}
......
......@@ -17,6 +17,7 @@ Project Recovery
Changes
#######
- Project Recovery will no longer save groups, this fixes an issue where it would cause crashes if you deleted a workspace from a group.
- Project Recovery will no longer run certain Save Algorithms again, so you won't get duplication of files when recovering.
Bugfixes
########
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment