Skip to content

feat: add cleanup routines for files in working directory#262

Open
nakul680 wants to merge 7 commits into
faccts:mainfrom
nakul680:feat/258-add-cleanup-functions
Open

feat: add cleanup routines for files in working directory#262
nakul680 wants to merge 7 commits into
faccts:mainfrom
nakul680:feat/258-add-cleanup-functions

Conversation

@nakul680

@nakul680 nakul680 commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

Closes Issues

Closes #258

Description

  • Add functions to cleanup files created by ORCA jobs.

Release Notes

Added

@nakul680 nakul680 self-assigned this Jul 10, 2026
@nakul680 nakul680 requested a review from a team as a code owner July 10, 2026 16:10

@haneug haneug left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice PR. Please see my comments. It would also be good to add some unit tests to see which files get deleted.

Comment thread src/opi/output/core.py
Comment thread src/opi/output/core.py
Comment thread src/opi/output/core.py
Comment thread src/opi/output/core.py Outdated

@timmyte timmyte left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for implementing these helper functions.
There are some design decisions, which I would like to discuss.
@haneug
Also happy for your input.

Comment thread src/opi/output/core.py Outdated
basename = self.basename
return self.working_dir / (basename + suffix)

def _delete_files(self, basename: str | None, *, suffixes: Sequence[str] | None = None) -> None:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

  1. Any particular reason that basename has no default?
    I would assume having one makes the API a bit smoother.
  2. I'm note huge fan to allow string parameters to also be None, because an empty string typically acts as the null value. Any particular reason to have None here?
  3. I would use an empty tuple as default for Sequence-like parameters.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I think having a None value makes it clear that the option of providing a basename other than self.basename is optional , and if its not given then OPI will default to self.basename. I also dont really think the API is changed much . I would like to maintain as much clarity as possible when it comes to deleting files which is why i added the None option.

I would however add a default of None

Comment thread src/opi/output/core.py Outdated
Comment thread src/opi/output/core.py Outdated
if not basename:
raise ValueError("No basename specified")
files: Iterable[Path]
if suffixes is None:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What if the sequence is empty? Which behavior is expected then?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

If the sequences is empty the function would essentially be a no-op

Comment thread src/opi/output/core.py
Comment thread src/opi/output/core.py
Comment thread src/opi/output/core.py Outdated
Comment thread src/opi/output/core.py
@nakul680 nakul680 requested review from haneug and timmyte July 15, 2026 13:57
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.

Add cleanup functions for files created by ORCA

3 participants