Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

Make SDExport.exit_gracefully more standalone #44

Closed
redshiftzero opened this issue Dec 19, 2019 · 1 comment · Fixed by #105
Closed

Make SDExport.exit_gracefully more standalone #44

redshiftzero opened this issue Dec 19, 2019 · 1 comment · Fixed by #105
Assignees

Comments

@redshiftzero
Copy link
Contributor

Followup from #41 (see comment here)

I'm not sure how to best do this, but when I was working on #41, I was wondering if we can make SDExport.exit_gracefully more standalone to decouple more code from SDExport. It would be nice to extract that method into a utility function since it's used almost everywhere. The challenge is that part of its cleanup is (if it exists) it's removing a submission's tmpdir. We'd either need to pass the tmpdir around everywhere, which is messy, or just leave it as a method on SDExport, or do something else. If anyone has any ideas on how to nicely refactor this, get loud.

@rmol
Copy link
Contributor

rmol commented Dec 19, 2019

How about:

  • dispensing with exit_gracefully and just letting exceptions bubble
  • adding tmpdir to SDExport.__init__ arguments
  • in entrypoint.start, using with tempfile.TemporaryDirectory() as tmpdirname: around construction/usage of SDExport, and catching any exceptions in one finally block where we ensure we print something and exit 0

It would mean some tedious refactoring of the exit_gracefully calls to raise exceptions from ExportStatus messages.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants