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

Check on snapshot DB name is not smart #1724

Open
keckler opened this issue Jun 6, 2024 · 2 comments
Open

Check on snapshot DB name is not smart #1724

keckler opened this issue Jun 6, 2024 · 2 comments
Labels
low priority Style points and non-features

Comments

@keckler
Copy link
Member

keckler commented Jun 6, 2024

There is a settings validator that checks the name of the database being used in a snapshot run:

self.addQuery(
lambda: self.cs.caseTitle.lower()
== os.path.splitext(os.path.basename(self.cs["reloadDBName"].lower()))[0],
"Snapshot DB ({0}) and main DB ({1}) cannot have the same name."
"Change name of settings file and resubmit.".format(
self.cs["reloadDBName"], self.cs.caseTitle
),
"",
self.NO_ACTION,
)

This check tries to ensure that the snapshot DB and the current run name are not the same, presumably so that the old DB doesn't get overwritten.

This check does not account for the fact that the snapshot DB might be in a different directory, in which case there wouldn't be any issue and the warning is misguided.

@keckler keckler added the low priority Style points and non-features label Jun 6, 2024
@john-science
Copy link
Member

This check does not account for the fact that the snapshot DB might be in a different directory, in which case there wouldn't be any issue and the warning is misguided.

Doesn't it?

In this line:

== os.path.splitext(os.path.basename(self.cs["reloadDBName"].lower()))[0],

The os.path.basename() gets the file name from the path.

@john-science john-science self-assigned this Jun 10, 2024
@john-science
Copy link
Member

We discussed, and our suggested change goes something like this:

  1. Check the reloadDB path is not in the current directory, and that it is not a child current/working dir
    • (It would be nice if we could guarantee the case suite child naming.)
  2. It can be in the current/working dir, if it has a different name than the caseTitle (this is the current check)

The only thing I'm not sure about is if we can get the "current working directory" safely in call cases in this lambda function.

@john-science john-science removed their assignment Jun 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
low priority Style points and non-features
Projects
None yet
Development

No branches or pull requests

2 participants