Exemple #1
0
def populate_job_queue():
    queue = RedisQueue('jobs')
    with CountriesDB() as countries_db:

        countries = countries_db.get_countries()
        for country in countries:
            job = {'country_id': country[0], 'num_records': 5000}
            job_in_json = json.dumps(job)
            queue.enqueue(job_in_json)
def add_job_to_queue(country_id, num_records):
    queue = RedisQueue('jobs')
    job = {'country_id': country_id, 'num_records': num_records}
    job_in_json = json.dumps(job)
    queue.enqueue(job_in_json)