How to force celery tasks be executed in the same host?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I'm working to implement an architecture based on Flask + Celery to process images. See image below:
The Celery client (producer) is a flask app that will receive images to be processed and push them into RabbitMQ to be consumed by celery workers.
The system can automatically start and stop new workers nodes based on the demand. Each celery worker node will be running with multiple threads (--concurrency parameter).
I'm thinking to have a single thread to consume from the default celery queue. Then any node is eligible to process the images.
Once a given node get/consume the image from the queue, the image will be placed locally in a in-memory database.
As I'm dealing with images, I want to avoid images flowing between different nodes through the network.
The image processing will be composed base many tasks and will be executed using a chain().
So, once I have a given image locally how can I force all the other sub-tasks (chain) be executed always in the same host ?
I know that I can create specific queues and assign those queues to workers in each node, but I don't know if this is the best/only solution, neither how to do it be dynamic.
Best Regards.
Kleyson Rios.
flask celery celery-task
add a comment |
I'm working to implement an architecture based on Flask + Celery to process images. See image below:
The Celery client (producer) is a flask app that will receive images to be processed and push them into RabbitMQ to be consumed by celery workers.
The system can automatically start and stop new workers nodes based on the demand. Each celery worker node will be running with multiple threads (--concurrency parameter).
I'm thinking to have a single thread to consume from the default celery queue. Then any node is eligible to process the images.
Once a given node get/consume the image from the queue, the image will be placed locally in a in-memory database.
As I'm dealing with images, I want to avoid images flowing between different nodes through the network.
The image processing will be composed base many tasks and will be executed using a chain().
So, once I have a given image locally how can I force all the other sub-tasks (chain) be executed always in the same host ?
I know that I can create specific queues and assign those queues to workers in each node, but I don't know if this is the best/only solution, neither how to do it be dynamic.
Best Regards.
Kleyson Rios.
flask celery celery-task
Possible duplicate of Route to worker depending on result in Celery?
– 2ps
Nov 18 '18 at 21:53
add a comment |
I'm working to implement an architecture based on Flask + Celery to process images. See image below:
The Celery client (producer) is a flask app that will receive images to be processed and push them into RabbitMQ to be consumed by celery workers.
The system can automatically start and stop new workers nodes based on the demand. Each celery worker node will be running with multiple threads (--concurrency parameter).
I'm thinking to have a single thread to consume from the default celery queue. Then any node is eligible to process the images.
Once a given node get/consume the image from the queue, the image will be placed locally in a in-memory database.
As I'm dealing with images, I want to avoid images flowing between different nodes through the network.
The image processing will be composed base many tasks and will be executed using a chain().
So, once I have a given image locally how can I force all the other sub-tasks (chain) be executed always in the same host ?
I know that I can create specific queues and assign those queues to workers in each node, but I don't know if this is the best/only solution, neither how to do it be dynamic.
Best Regards.
Kleyson Rios.
flask celery celery-task
I'm working to implement an architecture based on Flask + Celery to process images. See image below:
The Celery client (producer) is a flask app that will receive images to be processed and push them into RabbitMQ to be consumed by celery workers.
The system can automatically start and stop new workers nodes based on the demand. Each celery worker node will be running with multiple threads (--concurrency parameter).
I'm thinking to have a single thread to consume from the default celery queue. Then any node is eligible to process the images.
Once a given node get/consume the image from the queue, the image will be placed locally in a in-memory database.
As I'm dealing with images, I want to avoid images flowing between different nodes through the network.
The image processing will be composed base many tasks and will be executed using a chain().
So, once I have a given image locally how can I force all the other sub-tasks (chain) be executed always in the same host ?
I know that I can create specific queues and assign those queues to workers in each node, but I don't know if this is the best/only solution, neither how to do it be dynamic.
Best Regards.
Kleyson Rios.
flask celery celery-task
flask celery celery-task
asked Nov 16 '18 at 14:38
Kleyson RiosKleyson Rios
2112418
2112418
Possible duplicate of Route to worker depending on result in Celery?
– 2ps
Nov 18 '18 at 21:53
add a comment |
Possible duplicate of Route to worker depending on result in Celery?
– 2ps
Nov 18 '18 at 21:53
Possible duplicate of Route to worker depending on result in Celery?
– 2ps
Nov 18 '18 at 21:53
Possible duplicate of Route to worker depending on result in Celery?
– 2ps
Nov 18 '18 at 21:53
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53339950%2fhow-to-force-celery-tasks-be-executed-in-the-same-host%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53339950%2fhow-to-force-celery-tasks-be-executed-in-the-same-host%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Possible duplicate of Route to worker depending on result in Celery?
– 2ps
Nov 18 '18 at 21:53