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

Enh: preserve change_ids within a session and beyond #99

Open
LukasGold opened this issue Nov 28, 2024 · 0 comments
Open

Enh: preserve change_ids within a session and beyond #99

LukasGold opened this issue Nov 28, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@LukasGold
Copy link
Contributor

LukasGold commented Nov 28, 2024

Idea

  • The functions / methods store_entity and upload_file return an object that has a change_id property
  • It would be neat to have an attribute of OSW/OswExpress that collects all change_ids of applicable processes
  • A context manager or a function decorated with @atexit.register from atexit would be required for implementation
    • At exit, the change_ids could be printed to the console
    • At exit, a file could be created, documenting the session with start and end time and list the change_ids.
      • The start time could be the file name
      • The default location for such a file could be the osw_files directory

At the moment change_ids can be collected and preseved like this:

stored = []
# Storing an entity requires only one line:
res = osw_obj.store_entity(john)
# But to be able to access all storage event later on, we will append the result to the list
stored.append(res)
change_ids = [res.change_id for res in stored]
with open(filepath, "w", enconding="utf-8) as file:
    file.write({
        "session_start": timestamp1,
        "session_end": timestamp2,
        "change_ids": change_ids
    })

This is rather lengthy and must be considered before making changes to an OSL instance

@LukasGold LukasGold added the enhancement New feature or request label Nov 28, 2024
@LukasGold LukasGold self-assigned this Nov 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant