Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide compatibility for backups pre-6.9 #36914

Merged
merged 1 commit into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/source/release/v6.9.0/mantidworkbench.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ New Features
- Editing a plot's title will now automatically update its name in the plot selector (and vice versa).
- Monitor for external changes to script files that are open in Mantid to prevent loss of work.
- An email is now required to submit an error report.
- Project recovery performance has been improved by saving one python file for all workspaces, rather than one python file per workspace. Caution: recovering a backup by opening 6.9.0 after a crash in 6.8.0 or earlier will not work.
- Project recovery performance has been improved by saving one python file for all workspaces, rather than one python file per workspace.


Bugfixes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

from qtpy.QtWidgets import QApplication

from mantid.api import AlgorithmManager
from mantid.kernel import logger
from mantidqt.project.projectloader import ProjectLoader
from workbench.projectrecovery.recoverygui.projectrecoverypresenter import ProjectRecoveryPresenter
Expand Down Expand Up @@ -98,9 +99,22 @@ def _copy_in_recovery_script(self, directory):
:param directory: String; The directory in which the load_workspaces.py files exists
"""
saved_recovery_script = os.path.join(directory, "load_workspaces.py")

if os.path.exists(saved_recovery_script):
with open(saved_recovery_script, "r") as reader, open(self.pr.recovery_order_workspace_history_file, "w") as writer:
writer.write(reader.read())
elif os.path.exists(directory):
# This is to ensure compatibility with backups from version 6.8 and earlier.
# Prior to 6.9, one python file would be saved for each workspace in the ADS.
alg_name = "OrderWorkspaceHistory"
alg = AlgorithmManager.createUnmanaged(alg_name, 1)
alg.initialize()
alg.setChild(True)
alg.setLogging(False)
alg.setRethrows(False)
alg.setProperty("RecoveryCheckpointFolder", directory)
alg.setProperty("OutputFilePath", self.pr.recovery_order_workspace_history_file)
alg.execute()

self.multi_file_interpreter.mark_file_change_as_ours(self.pr.recovery_order_workspace_history_file)

Expand Down
Loading