-
Notifications
You must be signed in to change notification settings - Fork 296
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 module 'apps.schedules.tasks.notify_about_empty_shifts_in_schedule' has no attribute 'apply_async'
AttributeError
#3640
Conversation
…le' has no attribute 'apply_async'` `AttributeError`
@@ -2,7 +2,7 @@ | |||
|
|||
from apps.alerts.tasks import notify_ical_schedule_shift | |||
from apps.schedules.ical_utils import is_icals_equal | |||
from apps.schedules.tasks import notify_about_empty_shifts_in_schedule, notify_about_gaps_in_schedule |
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.
There was a naming clash between modules and functions with the same name here. This ☝️ import
statement is importing the modules notify_about_empty_shifts_in_schedule
and notify_about_gaps_in_schedule
from the engine/apps/schedules/tasks
directory not the similarly named functions that're imported into engine/apps/schedules/tasks/__init__.py
(or at least this is my hypothesis/understanding)
"apps.schedules.tasks.notify_about_gaps_in_schedule.notify_about_empty_shifts_in_schedule": {"queue": "default"}, | ||
"apps.schedules.tasks.notify_about_gaps_in_schedule.notify_about_gaps_in_schedule_task": {"queue": "default"}, |
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.
apps.schedules.tasks.notify_about_gaps_in_schedule.notify_about_empty_shifts_in_schedule
is a typo, it does not correspond to a real function.
I've simply moved apps.schedules.tasks.notify_about_gaps_in_schedule.notify_about_gaps_in_schedule
up in the dict to be alongside the other apps.schedules.tasks.notify_about_gaps_in_schedule
module tasks
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.
without this change, and with the fix in engine/apps/schedules/tasks/__init__.py
, this file was resulting in a circular import, hence moving the import inside of the function where it is being used
…le' has no attribute 'apply_async'` `AttributeError` (#3640) # Which issue(s) this PR fixes We've been seeing this `AttributeError` quite frequently for quite some time ([logs](https://ops.grafana-ops.net/explore?schemaVersion=1&panes=%7B%22oPl%22:%7B%22datasource%22:%22000000193%22,%22queries%22:%5B%7B%22refId%22:%22A%22,%22expr%22:%22%7Bcluster%3D~%5C%22prod-%28eu-west-0%7Cus-central-0%29%5C%22,%20namespace%3D%5C%22amixr-prod%5C%22%7D%20%7C%3D%20%60AttributeError%28%5C%22module%20%27apps.schedules.tasks.notify_about_empty_shifts_in_schedule%27%20has%20no%20attribute%20%27apply_async%27%5C%22%60%22,%22queryType%22:%22range%22,%22datasource%22:%7B%22type%22:%22loki%22,%22uid%22:%22000000193%22%7D,%22editorMode%22:%22code%22%7D%5D,%22range%22:%7B%22from%22:%22now-7d%22,%22to%22:%22now%22%7D%7D%7D&orgId=1)) ## Checklist - [ ] Unit, integration, and e2e (if applicable) tests updated - [x] Documentation added (or `pr:no public docs` PR label added if not required) - [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not required)
Which issue(s) this PR fixes
We've been seeing this
AttributeError
quite frequently for quite some time (logs)Checklist
pr:no public docs
PR label added if not required)CHANGELOG.md
updated (orpr:no changelog
PR label added if not required)