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

DB interface & safety improvements #5330

Merged
merged 4 commits into from
Jan 27, 2023
Merged

DB interface & safety improvements #5330

merged 4 commits into from
Jan 27, 2023

Conversation

MetRonnie
Copy link
Member

@MetRonnie MetRonnie commented Jan 25, 2023

Partially addresses same issue as #5313

  • Do not create tables by default, only if specified via kwarg
  • Provide context manager functionality to automatically close DB connection
  • A WorkflowDatabaseManager should only be created by Scheduler; just use CylcWorkflowDAO elsewhere, or certain static methods on WorkflowDatabaseManager

Check List

  • I have read CONTRIBUTING.md and added my name as a Code Contributor.
  • Contains logically grouped changes (else tidy your branch by rebase).
  • Does not contain off-topic changes (use other PRs for other changes).
  • Applied any dependency changes to both setup.cfg and conda-environment.yml.
  • Tests are included (or explain why tests are not needed).
  • No changelog entry needed (invisible to users)
  • No docs entry needed
  • If this is a bug fix, PR should be raised against the relevant ?.?.x branch.

@MetRonnie MetRonnie added this to the 8.1.1 milestone Jan 25, 2023
@MetRonnie MetRonnie self-assigned this Jan 25, 2023
- Do not create tables by default, only if specified via kwarg
- Provide context manager functionality to automatically close DB connection
- A WorkflowDatabaseManager should only be created by Scheduler; just use CylcWorkflowDAO elsewhere
@MetRonnie MetRonnie changed the title DB safety improvements DB interface & safety improvements Jan 26, 2023
@MetRonnie MetRonnie requested a review from wxtim January 26, 2023 11:30
cylc/flow/rundb.py Outdated Show resolved Hide resolved
Copy link
Member

@wxtim wxtim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've learned a fair bit about SQLite this morning. It Looks sane - will wait for tests to pass on CI before downloading and playing with branch.

@MetRonnie MetRonnie marked this pull request as ready for review January 26, 2023 12:14
@MetRonnie
Copy link
Member Author

(Test failure is just linkcheck)

if db_file.exists():
dao = CylcWorkflowDAO(db_file, is_public=False)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh, scan was reading private DBs in spite of the comment above? 😬

Copy link
Member Author

@MetRonnie MetRonnie Jan 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was reading the private DB until b338a91 when the comment was added. But the is_public arg of CylcWorkflowDAO() was not updated in that PR

Copy link
Member

@hjoliver hjoliver left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

Co-authored-by: Tim Pillinger <26465611+wxtim@users.noreply.github.com>
@hjoliver hjoliver merged commit 8c855b4 into cylc:8.1.x Jan 27, 2023
@MetRonnie MetRonnie deleted the db-2 branch January 27, 2023 10:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants