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 module 'apps.schedules.tasks.notify_about_empty_shifts_in_schedule' has no attribute 'apply_async' AttributeError #3640

Merged
merged 8 commits into from
Jan 10, 2024

Conversation

joeyorlando
Copy link
Contributor

Which issue(s) this PR fixes

We've been seeing this AttributeError quite frequently for quite some time (logs)

Checklist

  • Unit, integration, and e2e (if applicable) tests updated
  • Documentation added (or pr:no public docs PR label added if not required)
  • CHANGELOG.md updated (or pr:no changelog PR label added if not required)

…le' has no attribute 'apply_async'` `AttributeError`
@joeyorlando joeyorlando added the pr:no public docs Added to a PR that does not require public documentation updates label Jan 9, 2024
@joeyorlando joeyorlando self-assigned this Jan 9, 2024
@joeyorlando joeyorlando requested a review from a team January 9, 2024 22:28
@@ -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
Copy link
Contributor Author

@joeyorlando joeyorlando Jan 9, 2024

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"},
Copy link
Contributor Author

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

Copy link
Contributor Author

@joeyorlando joeyorlando Jan 10, 2024

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

@joeyorlando joeyorlando merged commit f20aa75 into dev Jan 10, 2024
20 checks passed
@joeyorlando joeyorlando deleted the jorlando/fix-attribute-error branch January 10, 2024 11:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr:no public docs Added to a PR that does not require public documentation updates
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants