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

global: change the config for celery 4 #242

Merged
merged 2 commits into from
May 15, 2018
Merged

global: change the config for celery 4 #242

merged 2 commits into from
May 15, 2018

Conversation

jacquerie
Copy link
Contributor

@jacquerie jacquerie commented May 11, 2018

Description:

#241 forgot to update the configuration for Celery 4, which led to a failure to perform the harvest on QA and https://gitlab.cern.ch/ai/it-puppet-hostgroup-inspire/commit/bb030ed9dea6a231cdedde4d8aa1349f92e91425 to fix it. This PR aims to make the above commit unnecessary. I wasn't able to use CELERY_BROKER_URL instead of BROKER_URL. I don't know the reason, but all this means is that the above commit is here to stay.

Checklist:

  • I have all the information that I need (if not, move to RFC and look for it).
  • I linked the related issue(s) in the corresponding commit logs.
  • I wrote good commit log messages.
  • My code follows the code style of this project.
  • I've added any new docs if API/utils methods were added.
  • I have updated the existing documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@ghost ghost assigned jacquerie May 11, 2018
@ghost ghost added the Review: WIP label May 11, 2018
@@ -176,7 +176,7 @@ def __init__(self):

def open_spider(self, spider):
self.celery.conf.update(dict(
BROKER_URL=spider.settings['BROKER_URL'],
CELERY_BROKER_URL=spider.settings['CELERY_BROKER_URL'],
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

jacquerie added 2 commits May 14, 2018 16:55
Signed-off-by: Jacopo Notarstefano <jacopo.notarstefano@gmail.com>
Signed-off-by: Jacopo Notarstefano <jacopo.notarstefano@gmail.com>
BROKER_URL = "amqp://guest:guest@rabbitmq:5672//"
CELERY_ALWAYS_EAGER = True
CELERY_CACHE_BACKEND = 'memory'
CELERY_EAGER_PROPAGATES_EXCEPTIONS = True
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These three configuration variables have not had effect for a long time, as they are not valid or ignored in Celery 4, so we can safely remove them.

@@ -19,11 +19,8 @@


class Config(object):
CELERY_RESULT_BACKEND = "amqp://guest:guest@rabbitmq:5672//"
BROKER_URL = "amqp://guest:guest@rabbitmq:5672//"
CELERY_ALWAYS_EAGER = True
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm surprised the tests don't require some flavor of this, but they seem to pass, so it must be OK.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This happens to work because of the Celery Monitor, which essentially attaches receivers that listen to signals like "a task completed successfully":

self.recv = self.app.events.Receiver(
self.connection,
handlers={
'task-succeeded': announce_succeeded_tasks,
'task-failed': announce_failed_tasks,
},
)
.

BTW, as remarked in #241, hepcrawl has been tested for a long time against Celery 4, and the name of this parameter changed to task_always_eager, so this configuration option has had no effect for who knows how much time.

@michamos
Copy link
Contributor

@ammirate Don't know how this affects your e2e tests

@jacquerie jacquerie merged commit c3f788c into inspirehep:master May 15, 2018
@ghost ghost removed the Review: WIP label May 15, 2018
@jacquerie jacquerie deleted the really-bump-celery-4 branch May 15, 2018 12:46
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.

2 participants