Skip to content

Conversation

@dwhswenson
Copy link
Member

@dwhswenson dwhswenson commented Dec 1, 2023

This is a subset of the work in #234, split off to facilitate review. This PR will merge into #258 (making it easier to see the additions specific to the PR, but meaning that this should be merged before that)

This handles the serialization of StagingPath objects. (detailed description will be coming in a future edit)

TODO:

  • Add user story where the type of external storage is changed
  • Add user story where the a new JSONCodec is added after the StagingSerialization is created.
  • Docstrings
  • Attach to the StorageManager

@pep8speaks
Copy link

pep8speaks commented Dec 1, 2023

Hello @dwhswenson! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

Line 68:1: E303 too many blank lines (3)

Comment last updated at 2023-12-22 16:58:26 UTC

@dwhswenson dwhswenson marked this pull request as draft December 1, 2023 19:47
Comment on lines +61 to +63
self.refresh_handler()

def refresh_handler(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

what's the need for the refresh_handler to be a method rather than just inlined into __init__?

or what's the harm in just adding to JSONCodec on the import of this module?

Copy link
Member Author

Choose a reason for hiding this comment

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

what's the need for the refresh_handler to be a method rather than just inlined into init?

In principle, the codecs in JSON_HANDLER can change. For example, an external package can register additional handlers. Since So we at least want the ability to refresh. In fact, I was thinking about whether the encoder/decoder properties maybe should call refresh_handler.

or what's the harm in just adding to JSONCodec on the import of this module?

I'm not sure what you mean by "adding to JSONCodec." Could you clarify?

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry I meant JSON_HANDLER. Other Codecs are defined and just appended onto the HANDLER as they are defined, so the HANDLER is "batteries included". Is there a reason this Codec can't have the same treatment?

Copy link
Member Author

Choose a reason for hiding this comment

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

  1. We don't know the storage paths at import time, so this is literally impossible.
  2. We may have more than one set of shared/permanent (especially permanent) defined in a given process. Imagine that I'm working with data from multiple campaigns. Imagine furthermore that I've use the keep_shared option so that my shared stuff is also still accessible. This precludes any kind of serialization that relies on global state. This test is specifically to prevent us from making this mistake.

@dwhswenson dwhswenson merged commit b22445b into staging-execute-dag Jan 10, 2024
@dwhswenson dwhswenson deleted the staging-serialization branch January 10, 2024 17:58
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.

4 participants