Git Product home page Git Product logo

Comments (2)

joshwilson-dbx avatar joshwilson-dbx commented on June 2, 2024 3

A few things here:

You're dropping the ctx on the floor. It should be something like this instead:

def partial(f, *args, **kwargs):

    @wraps(f)
    async def partial_function(ctx):
        return await f(ctx, *args, **kwargs)

    return partial_function

You're also currently passing in an empty {} which is populating your ctx parameter, hence the empty context. You don't need that anymore.

Finally, it looks like arq uses the job name as a key for its internal lookup tables. By default, it uses your job function's name. So since you're using the same function twice, the first gets stomped.

Try using the name= parameter to cron(). To keep with the default convention, you'll probably want to keep the cron: prefix:

class WorkerSettings:
    cron_jobs = [
        cron(
            partial(my_test_cron_job, store_id="826b2e76-be55-42d0-9022-7f7c26b430cd"),
            hour=at_every_x_hour(1),
            minute=at_every_y_minutes(1),
            run_at_startup=True,
            job_id="id1",
            name="cron:my_test_cron_job_id1",
        ),
        cron(
            partial(my_test_cron_job, store_id="33beef9c-dfd3-42b7-a78b-706f29f8fcgt"),
            hour=at_every_x_hour(1),
            minute=at_every_y_minutes(1),
            run_at_startup=True,
            job_id="id2",
            name="cron:my_test_cron_job_id2",
        ),
    ]

from arq.

fmatten avatar fmatten commented on June 2, 2024 2

I tested the last comment from Issue #263 .

Now with your correction it is functional

Many Thanks!

from arq.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.