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

Add options to index celery tasks in the host queue #4459

Closed
wants to merge 1 commit into from

Conversation

ericholscher
Copy link
Member

@ericholscher ericholscher commented Aug 2, 2018

This lets us run async celery tasks in prod, but only on one machine that
is setup for the new ES.

This also pulled in master with the merge, but the only commit to look at is ca02c48

This lets us run async celery tasks in prod,
but only on one machine that is setup for the new ES.
@safwanrahman
Copy link
Member

@ericholscher I have cherry picked the commit and forced push to your branch. Now it looks good.

@@ -32,7 +33,13 @@ def _get_indexing_tasks(app_label, model_name, queryset, document_class, index_n
}
yield index_objects_to_es.si(**data)

def _run_reindex_tasks(self, models):
def _run_reindex_tasks(self, models, host_queue):
apply_async_kwargs = {'priority': 0}
Copy link
Member

Choose a reason for hiding this comment

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

I dont think priority is necessary.

@safwanrahman
Copy link
Member

safwanrahman commented Aug 2, 2018

@ericholscher I think if you want to run the command in the same celery instance, you can use CELERY_ALWAYS_EAGER=True so it wont go to the broker instead will run in the self instance. Do you think something special is needed for this?

@ericholscher
Copy link
Member Author

ericholscher commented Aug 2, 2018

CELERY_ALWAYS_EAGER runs it in a single process. We want multiple celery workers processing the tasks, but on the same host.

@safwanrahman
Copy link
Member

Looks good other than the priority one. r+

Copy link
Member

@humitos humitos left a comment

Choose a reason for hiding this comment

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

Looks good. Small comments.

parser.add_argument(
'--host-queue',
dest='host_queue',
action='store_true',
Copy link
Member

Choose a reason for hiding this comment

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

I think it should be store only since it's a string what we want here.

@@ -32,7 +33,13 @@ def _get_indexing_tasks(app_label, model_name, queryset, document_class, index_n
}
yield index_objects_to_es.si(**data)

def _run_reindex_tasks(self, models):
def _run_reindex_tasks(self, models, host_queue):
Copy link
Member

Choose a reason for hiding this comment

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

I'd use a default value here host_queue=None.

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like we should default False here, the parser option is boolean default False

Copy link
Member

Choose a reason for hiding this comment

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

I think that None makes more sense since we are expecting a str not a bool and the parser option should also be changed to None.

Copy link
Contributor

Choose a reason for hiding this comment

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

Both of these points are expecting host_queue to be a bool though, so the logic so far stands.

It would be more work to run the command, but probably less prone to breakage if we don't auto-determine the queue name. In that case, we shouldn't have a default at all and should require the user enters a specific queue name.

@agjohnson agjohnson added the PR: work in progress Pull request is not ready for full review label Aug 27, 2018
@agjohnson agjohnson added this to the Search improvements milestone Aug 27, 2018
@safwanrahman
Copy link
Member

This commit is added in #4636. so closing!

@stsewd stsewd deleted the search-deploy-additions branch September 21, 2018 23:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: work in progress Pull request is not ready for full review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants