Use our forked analytics-python#1172
Conversation
This comment has been minimized.
This comment has been minimized.
6cf5072 to
049b2bc
Compare
|
Checking git merge conflicts against https://github.com/edx/edx-platform.git
|
Pull Request Test Coverage Report for Build 2515013695
💛 - Coveralls |
OmarIthawi
left a comment
There was a problem hiding this comment.
first of all, thanks for getting to the bottom of this bug.
this is a big change, could you please open a upstream pull request and explain why do you think this is a bug? I know that we've already forked the repo but the change isn't trivial to test or review.
This change seems very dangerous since it touches threading/multiprocessing
think about: servers going out of memory, site data leaks or bringing servers down.
such changes actually shouldn't be done without consulting with the package maintainers in my opinion.
i.e. I'd rather accept the bug and wait for a couple of months to ensure we did the right thing instead of potentially hurting our production instances.
|
in other words @shadinaif. I don't understand well the changes done appsembler/analytics-python#2 . it seems too good to be true it raises a red-flag because we don't really know the implication of the change. |
|
I'm not angry, I'm just trying to scrap my head about the change. Please check the links below becasue I think we have a sync_mode which skips queueing: |
|
Thank you @OmarIthawi ! Processes are created anyway by Celery with or without the fix. The problem is that this is not compatible with normal queues. When Celery forks the process; the queue in the thread is duplicated because it's a Python thread, not a real thread. On the other hand, the problem with What should we do?
|
none are good alternatives in my opinion.
Yes but only in celery. The default_client = Client(write_key, ..., sync_mode=bool(settings.IS_CELERY))or using a Lines 71 to 74 in 9baaffb the idea is to clear the segment queue after each task run instead of |
|
@shadinaif @OmarIthawi Maybe a workaround to consider is to make an upstream PR to Segment, and in the meantime change our Celery config so that the queue used for any task that will generate an event via a worker not use multiple processes. I believe the only ones that do are PersistentGrade calculation and the Completion Aggregator tasks. We could create a new queue just for them and only allow 1 process. Correct me if I'm wrong, but I believe it's the EDXAPP_CELERY_WORKERS:
service_variant: lms
concurrency: 8
monitor: true
prefetch_optimization: fair
max_tasks_per_child: 1000(abbreviated) |
I think that's a great idea. As long as we're getting help on the review for the Queue changes we're fine.
I'll let Shadi comment on this part. Here are other alternatives that I'm proposing: |
|
Thank you @bryanlandia and @OmarIthawi . Looks like we have many good options. I see |
|
Closed in favour of #1175 |
Change description
Use our forked analytics-python
Type of change
Related issues
https://appsembler.atlassian.net/browse/RED-2969
Checklists
Development
Security
Code review