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

[AIRFLOW-2921][AIRFLOW-2922] Fix two potential bugs in CeleryExecutor() #3773

Merged
merged 1 commit into from Aug 22, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions airflow/executors/celery_executor.py
Expand Up @@ -104,8 +104,8 @@ def sync(self):
del self.tasks[key]
del self.last_state[key]
else:
self.log.info("Unexpected state: %s", task.state)
self.last_state[key] = task.state
self.log.info("Unexpected state: %s", state)
self.last_state[key] = state
Copy link
Member Author

@XD-DENG XD-DENG Aug 21, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • The indentation change is to fix potential bug-1.

  • Changing from task.state to state in both lines 107 and 108 are to fix potential bug-2

except Exception as e:
self.log.error("Error syncing the celery executor, ignoring it:")
self.log.exception(e)
Expand Down
2 changes: 2 additions & 0 deletions tests/executors/test_celery_executor.py
Expand Up @@ -54,6 +54,8 @@ def test_celery_integration(self):
self.assertNotIn('success', executor.tasks)
self.assertNotIn('fail', executor.tasks)

self.assertNotIn('success', executor.last_state)
self.assertNotIn('fail', executor.last_state)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test case change is for potential bug-1 only.


if __name__ == '__main__':
unittest.main()