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

Disk/memory modes of PersHelper #25

Merged
merged 8 commits into from
May 10, 2024
Merged

Disk/memory modes of PersHelper #25

merged 8 commits into from
May 10, 2024

Conversation

MandaloreUltimate
Copy link
Collaborator

Extend PersHelper class to support "disk" and "memory" ways of communicating the persistence between Jupyter and subprocess - using either files or pipes respectively.

PersHelper can now be configured with the following magic:

%%serializer_settings
<serializer_name: dill/cloudpickle>
<mode: disk/memory>

@MandaloreUltimate MandaloreUltimate force-pushed the feature/pipe-comm branch 2 times, most recently from ad7c34f to f4f6b56 Compare April 28, 2024 14:58
self.pershelper = PersHelper('cloudpickle')

self.cell_output(f'Serializer backend switched to {serializer}, persistence was reset.')
if serializer in ['dill', 'cloudpickle']:
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we have something non-static here, e.g. a config file so that we could support user-defined serializer as well? In the future, we don't want to change the code to plugin an alternative serializer.

def serializer_settings(self, serializer, mode):
error_message = ""

if serializer in ['dill', 'cloudpickle']:
Copy link
Collaborator

Choose a reason for hiding this comment

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

please also catch the following cases:

  • no serializer set -> use default one
  • no communication set -> use default one
    for both cases, please print the whole configuration (serializer and mode that is used)

if os.path.exists(scorep_script_name):
os.remove(scorep_script_name)

def serializer_settings(self, serializer, mode):
Copy link
Collaborator

Choose a reason for hiding this comment

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

following the comment from the other conversation, please try to make it as configurable as possible, i.e. in the future we might want to add custom serializers here

Copy link
Collaborator

@elwer elwer left a comment

Choose a reason for hiding this comment

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

please also update the README about the new magic command and the environment variable for the persistence directory.

@MandaloreUltimate MandaloreUltimate force-pushed the feature/pipe-comm branch 2 times, most recently from 3a3ae4a to 1bb31cb Compare May 9, 2024 04:38
@elwer elwer merged commit 56c88d4 into master May 10, 2024
1 check passed
@elwer elwer deleted the feature/pipe-comm branch August 22, 2024 12:16
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.

2 participants