Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8325397
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T00:25:26+00:00 2026-06-09T00:25:26+00:00

I’m developing a system that will build a huge n-gram model for an AI

  • 0

I’m developing a system that will build a huge n-gram model for an AI project.
My pipeline is the following:
Resource input –> Fetch data –> Parsers –> Trainer
The resource input (basically URLs that have to be parsed) is not constant, meaning I can introduce a bulk of thousands of resources at a time, later on another bulk of dozens and so on.

My idea is to implement each step of the pipeline as a Celery task and deploy it on the cloud (for instance, using Heroku’s worker dynos). But I’m new to Celery and I’m having doubts about how to queue these tasks to get my worker(s) working at 100% and mantaining the system’s integrity at the same time.
The straight forward approach is to start queueing tasks as soon as the previous one is finished, so for example if I get a resource input of 1000 items, I’d schedule 1000 “fetch data” tasks and each one of them would queue a “parse” task when finished and so on. But this will lead to a huge queue because more resources will come in before these tasks are finished, and I know it will take months to build the model (if it ever completes!).

So I’m not sure if Celery can handle all of that without falling into memory issues (Heroku have its limits) or any other problems I can’t imagine now. Or maybe I should use a more complicated technique like scheduling chunks of tasks every X minutes, storing partial results in the database, etc. which might avoid some of these problems but I won’t get the 100% of my workers time.

Any thoughts?
Thanks!


EDIT

The answer to my question is actually in the comments of the accepted answer

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T00:25:27+00:00Added an answer on June 9, 2026 at 12:25 am

    By having separate queues for each task and running a dedicated worker for each queue you can ensure that your system will utilize 100% system resources equally paying attention to each task. Additionally you can add workers to balance task processing based on task runtimes.

    For example, defining tasks

    @celery.task
    def fetch(url):
        # fetch url
        return html
    
    @celery.task
    def parse(html):
        pass
    

    And configuring automatic routing:

    CELERY_ROUTES = {‘tasks.fetch’: {‘queue’: ‘fetch_queue’},
    ‘tasks.parse’: {‘queue’: ‘parse_queue’}}

    And running workers:

    $ celery worker -Q fetch_queue
    
    $ celery worker -Q parse_queue
    

    You will have a separate worker for each task type.

    Using callbacks you can easily parse after fetching:

    fetch.apply_async((url), link=parse.subtask())
    

    P.S. For fetching worker you can use Eventlet pool to take advantage of asynchronous IO.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I need a function that will clean a strings' special characters. I do NOT
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I am doing a simple coin flipping experiment for class that involves flipping a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.