-
Notifications
You must be signed in to change notification settings - Fork 5
Conversation
so we can run `make format`
Thanks for the pull request, @pomegranited! Please note that it may take us up to several weeks or months to complete a review and merge your PR. Feel free to add as much of the following information to the ticket as you can:
All technical communication about the code itself will be done via the GitHub pull request interface. As a reminder, our process documentation is here. Please let us know once your PR is ready for our review and all tests are green. |
3d9688d
to
5a8400a
Compare
event_sink_clickhouse/signals.py
Outdated
try: | ||
from openedx.core.djangoapps.user_api.accounts.signals import USER_RETIREMENT_LMS_MISC | ||
except ImportError: | ||
# Tests don't have the platform installed | ||
USER_RETIREMENT_LMS_MISC = Signal() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should try to use an openedx event for this one, I think there isn't one but I'm not sure. I can do the contribution if needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the default retirement Signal inside edx-platform, it's used for a lot of things. I totally agree that we should refactor retirement to use openedx-events (and eventually the event bus), but I don't think we should do it as part of this work as I think it would further confuse an already complicated process.
5a8400a
to
f2d808b
Compare
@patch("event_sink_clickhouse.sinks.user_retire.UserRetirementSink.serialize_item") | ||
@patch("event_sink_clickhouse.sinks.user_retire.UserRetirementSink.is_enabled") | ||
@patch("event_sink_clickhouse.sinks.user_retire.UserRetirementSink.get_model") | ||
def test_retire_user(mock_user_model, mock_is_enabled, mock_serialize_item): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we get one more test that exercises the many
version of this, just to make sure no one breaks it in the future?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
model = "auth_user" | ||
unique_key = "id" | ||
clickhouse_table_name = ["user_profile", "external_id"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's sad that we don't have a more data driven way to deal with this list, but I think it's ok. Can you put a comment here reminding people that this list should exactly match EVENT_SINK_CLICKHOUSE_PII_MODELS
in the Aspects plugin? We'll probably want one there, too, to try to keep these from falling out of sync.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if we read this value from settings, and inject it in tutor-contrib-aspects
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And transform the PII_MODELS, and MODELS, settings into OVERRIDE_SETTINGS. So those cannot be overriden
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if this is a desired capability, but it is possible to define other sinks in plugins, so people may want to override those settings. I'm not 100% sure about the hierarchy of settings here, but I think if there's a default setting in this app, and a setting in tutor-contrib-aspects the latter will override. Then if an operator has other needs their specific config will take precedence. I think that would be my preference.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated tutor-contrib-aspects#529 to pass EVENT_SINK_CLICKHOUSE_PII_MODELS
in to the openedx settings, and modified this code to use that setting: edc380f
I'm doing a full rebuild of my Tutor dev stack to test this, but how does it look to you?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(rebuild worked.)
This setting is overriden in production by the Tutor environment, so that: * the full list of Clickhouse PII tables can be controlled by Aspects * end users can add their own PII tables too.
and alters the code to show coverage of this branch.
972e37c
to
2e41ccd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@pomegranited 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future. |
Description:
Adds an event sink for "user retirement" events.
On receipt of a
USER_RETIRE_LMS_MISC
Django signal for a given user, the sink will delete all records from the PII tables for that user, currently:ISSUE: openedx/tutor-contrib-aspects#449
Relates to: openedx/tutor-contrib-aspects#529
This PR should be merged/tagged first.
Merge deadline: none
Installation instructions:
To install this temporary branch on your local Tutor Aspects stack:
echo "git+https://github.com/openedx/openedx-event-sink-clickhouse.git@jill/retire-user#egg=openedx-event-sink-clickhouse==0.5.0" >> "$(tutor config printroot)/env/build/openedx/requirements/private.txt"
tutor config save -s ASPECTS_ENABLE_PII=True
tutor config save -s ASPECTS_PII_CACHE_LIFETIME=10
tutor config save -s RETIREMENT_COOL_OFF_DAYS=0
tutor images build openedx --no-cache
tutor local do init -l aspects
tutor local reboot -d
Testing instructions:
Use Superset's SQL Lab to check that the user profile change(s) flow through to the
event_sink.user_pii
table.event_sink.user_pii
table.tutor local retire-users
event_sink.user_pii
.Merge checklist:
Post merge:
finished.