Skip to content

Conversation

@robrap
Copy link
Contributor

@robrap robrap commented Jan 17, 2023

Description:

  • Updated time metadata to include UTC timezone. Original implementation used utcnow(), which could give different results if the time were ever
    interpreted to be local time. See https://docs.python.org/3/library/datetime.html#datetime.datetime.utcnow
  • Updated send_event to optionally take a time, which would be used for the metadata. Ideally, this will be explicitly set.

ISSUE:

  • Implements first part of Discovery: Signal metadata, event bus consumers, and timestamps #162
  • edx-platform will require an update to send the db time for the catalog event.
  • event-bus-kafka will require passing on the time during event production.
  • Another change is needed in this library for send_event_in_bus_consumer, which will require an additional breaking change to EventsMetadata. That will likely be made in a separate branch and merged into this PR.

Testing instructions:

  • Unit tests are probably enough for this change.
  • The edx-platform and event-bus-kafka changes that will use this will be used to provide more end-to-end testing.

Merge checklist:

  • All reviewers approved
  • CI build is green
  • Version bumped
  • Changelog record added
  • Documentation updated (not only docstrings)
  • Commits are squashed
  • Remove breaking change indicator from commit message

Post merge:

  • Create a tag
  • Check new version is pushed to PyPI after tag-triggered build is
    finished.
  • Delete working branch (if not needed anymore)

Author concerns:

I don't love how EventsMetadata is initialized with time that can be None, but this is how I think it needs to be done for the frozen attributes. Note, this pattern is going to be followed in the follow-up PR where all arguments need to be sent for event bus consumers.

Note: We found a way around this. :)

@robrap robrap force-pushed the robrap/add-time-and-fix-metadata branch 2 times, most recently from 606d5a7 to eaca0f6 Compare January 17, 2023 18:14
@robrap robrap self-assigned this Jan 17, 2023
@robrap robrap added the event-bus Work related to the Event Bus. label Jan 17, 2023
Copy link
Contributor

@rgraber rgraber left a comment

Choose a reason for hiding this comment

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

A few questions

Copy link
Contributor

@rgraber rgraber left a comment

Choose a reason for hiding this comment

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

One more thought about defaults

@robrap robrap changed the title feat!: updated event signal metadata time feat: updated event signal metadata time Jan 20, 2023
Copy link
Contributor

@rgraber rgraber left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the updates

* Updated time metadata to include UTC timezone.
Original implementation used utcnow(), which could
give different results if the time were ever
interpreted to be local time. See
https://docs.python.org/3/library/datetime.html#datetime.datetime.utcnow
* Updated send_event to optionally take a time, which
would be used for the metadata. Ideally, this will be
explicitly set.

#162
@robrap robrap force-pushed the robrap/add-time-and-fix-metadata branch from 04d9e2e to 52d6efc Compare January 23, 2023 15:53
@robrap robrap merged commit 5d07241 into main Jan 23, 2023
@robrap robrap deleted the robrap/add-time-and-fix-metadata branch January 23, 2023 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

event-bus Work related to the Event Bus.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants