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

fix(sse_recurring_task): reload sse/tasks #3108

Merged
merged 2 commits into from
Dec 11, 2023

Conversation

gagantrivedi
Copy link
Member

@gagantrivedi gagantrivedi commented Dec 7, 2023

Thanks for submitting a PR! Please check the boxes below:

  • I have run pre-commit to check linting
  • I have added information to docs/ if required so people know about the feature!
  • I have filled in the "Changes" section below?
  • I have filled in the "How did you test this code" section below?
  • I have used a Conventional Commit title for this Pull Request

Changes

We need to reload sse/tasks after setting RUN_BY_PROCESSOR because it's imported before (it is loaded as part of loading installed app) that environment var is set

Call Stack:

[0]   /home/gagan/Flag/flagsmith/api/manage.py(10)<module>()
-> execute_from_command_line(sys.argv)
[1]   /home/gagan/Flag/flagsmith/api/_venv/lib/python3.10/site-packages/django/core/management/__init__.py(419)execute_from_command_line()
-> utility.execute()
[2]   /home/gagan/Flag/flagsmith/api/_venv/lib/python3.10/site-packages/django/core/management/__init__.py(395)execute()
-> django.setup()
[3]   /home/gagan/Flag/flagsmith/api/_venv/lib/python3.10/site-packages/django/__init__.py(24)setup()
-> apps.populate(settings.INSTALLED_APPS)
[4]   /home/gagan/Flag/flagsmith/api/_venv/lib/python3.10/site-packages/django/apps/registry.py(122)populate()
-> app_config.ready()
[5]   /home/gagan/Flag/flagsmith/api/_venv/lib/python3.10/site-packages/django/contrib/admin/apps.py(27)ready()
-> self.module.autodiscover()
[6]   /home/gagan/Flag/flagsmith/api/_venv/lib/python3.10/site-packages/django/contrib/admin/__init__.py(24)autodiscover()
-> autodiscover_modules('admin', register_to=site)
[7]   /home/gagan/Flag/flagsmith/api/_venv/lib/python3.10/site-packages/django/utils/module_loading.py(47)autodiscover_modules()
[15]   /home/gagan/Flag/flagsmith/api/environments/admin.py(7)<module>()
-> from .tasks import rebuild_environment_document
-> from sse import (
-> from .sse_service import (  # noqa
-> from sse import tasks
-> @register_task_handler()

How did you test this code?

Adds unit test case
Tested manually by running the task processor manually to verify the task was installed, correctly

We need to reload sse/tasks after setting RUN_BY_PROCESSOR
because it's imported before (it is loaded as part
of loading installed app) that environment var is set

Call Stack:
```
[0]   /home/gagan/Flag/flagsmith/api/manage.py(10)<module>()
-> execute_from_command_line(sys.argv)
[1]   /home/gagan/Flag/flagsmith/api/_venv/lib/python3.10/site-packages/django/core/management/__init__.py(419)execute_from_command_line()
-> utility.execute()
[2]   /home/gagan/Flag/flagsmith/api/_venv/lib/python3.10/site-packages/django/core/management/__init__.py(395)execute()
-> django.setup()
[3]   /home/gagan/Flag/flagsmith/api/_venv/lib/python3.10/site-packages/django/__init__.py(24)setup()
-> apps.populate(settings.INSTALLED_APPS)
[4]   /home/gagan/Flag/flagsmith/api/_venv/lib/python3.10/site-packages/django/apps/registry.py(122)populate()
-> app_config.ready()
[5]   /home/gagan/Flag/flagsmith/api/_venv/lib/python3.10/site-packages/django/contrib/admin/apps.py(27)ready()
-> self.module.autodiscover()
[6]   /home/gagan/Flag/flagsmith/api/_venv/lib/python3.10/site-packages/django/contrib/admin/__init__.py(24)autodiscover()
-> autodiscover_modules('admin', register_to=site)
[7]   /home/gagan/Flag/flagsmith/api/_venv/lib/python3.10/site-packages/django/utils/module_loading.py(47)autodiscover_modules()
[15]   /home/gagan/Flag/flagsmith/api/environments/admin.py(7)<module>()
-> from .tasks import rebuild_environment_document
-> from sse import (
-> from .sse_service import (  # noqa
-> from sse import tasks
-> @register_task_handler()
```
Copy link

vercel bot commented Dec 7, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 7, 2023 8:37am
flagsmith-frontend-preview ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 7, 2023 8:37am
flagsmith-frontend-staging ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 7, 2023 8:37am

Copy link
Contributor

github-actions bot commented Dec 7, 2023

Uffizzi Preview deployment-42332 was deleted.

@codecov-commenter
Copy link

codecov-commenter commented Dec 7, 2023

Codecov Report

Attention: 5 lines in your changes are missing coverage. Please review.

Comparison is base (c60d5de) 95.92% compared to head (6ac8156) 95.91%.
Report is 3 commits behind head on main.

❗ Current head 6ac8156 differs from pull request most recent head 924bca5. Consider uploading reports for the commit 924bca5 to get more accurate results

Files Patch % Lines
...task_processor/management/commands/runprocessor.py 0.00% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3108      +/-   ##
==========================================
- Coverage   95.92%   95.91%   -0.01%     
==========================================
  Files        1037     1037              
  Lines       30882    30900      +18     
==========================================
+ Hits        29623    29638      +15     
- Misses       1259     1262       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@gagantrivedi gagantrivedi added this pull request to the merge queue Dec 11, 2023
Merged via the queue into main with commit 4e8e321 Dec 11, 2023
@gagantrivedi gagantrivedi deleted the fix/register_recurring_task branch December 11, 2023 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Issue related to the REST API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants