Skip to content

Enh: preserve change_ids within a session and beyond #99

@LukasGold

Description

@LukasGold

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

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions