Skip to content

Conversation

lpthong90
Copy link
Contributor

There's a bug when run python manage celery related to attribute preload_options not existed in CeleryCommand.

Copy link
Member

@auvipy auvipy left a comment

Choose a reason for hiding this comment

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

builds are failing

@@ -17,7 +17,6 @@ class Command(CeleryCommand):
preload_options = base.preload_options if base.preload_options else []
else:
preload_options = []
preload_options = base.preload_options if base.preload_options else []
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like this and the if/else block could be replace with just:

preload_options = getattr(base, 'preload_options', []) or []

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I fixed it. Thanks, @liquidpele :).

@lpthong90
Copy link
Contributor Author

@auvipy , it's failed looked like some others. I think it should be fixed somewhere but this PR.

@Peng-Xu
Copy link

Peng-Xu commented Jun 5, 2019

'CeleryCommand' object has no attribute 'preload_options'

@liquidpele
Copy link
Contributor

flake8 tests are failing now.

def _validate_thread_sharing(self):
if (not self.allow_thread_sharing and
self._thread_ident != _get_ident()):
if not self.validate_thread():
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you are missing the underscore for the method name you added?

raise DatabaseError(
DB_SHARED_THREAD % (
self.alias, self._thread_ident, _get_ident()),
)

BaseDatabaseWrapper.__init__ = _init
BaseDatabaseWrapper.validate_thread = _validate_thread
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@liquidpele , it doesn't have underscore here.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, I see. Didn't expand to look at the whole file. Thx.

@auvipy auvipy merged commit 9866b6b into celery:master Jun 6, 2019
maxmalysh pushed a commit to maxmalysh/django-celery that referenced this pull request Jul 29, 2019
* fix bug when run command `celery`

* refactor get preload_options from base

* fix failed by flask8

* fix tests

* remove redundant

* fix typo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants