Comments (2)
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.
I tested the last comment from Issue #263 .
Now with your correction it is functional
Many Thanks!
from arq.
Related Issues (20)
- [BUG] --watch does not reload code changes, despite console output saying so "files changed, reloading arq worker..." HOT 4
- How can I prevent cron from starting a new task if the previous one is still running? HOT 2
- Cannot enqueue job with a _job_id again, despite execution of the job being fully completed? HOT 5
- How do I handle job time out errors within the task?
- Arq - Worker stops when Redis connection is interrupted HOT 3
- Allow for user specified Redis key prefix HOT 3
- Future plan for Arq HOT 33
- `v0.26` release HOT 3
- [Question] Concurrent Functions
- crash if expires_ms is negative
- Grab Job in Queue and Cancel it HOT 1
- Dynamic Cron Jobs HOT 1
- Time based Queue. Handling X jobs per minute. HOT 1
- [Redis version] Library does not support latest redis version
- Poll for next batch of job when about to finish
- TypeError: Redis.__init__() got an unexpected keyword argument 'retry_on_error' HOT 5
- Scheduling repeated unique jobs HOT 5
- Support for redis > 5.0.x in pyproject.toml?
- Unable to run a cron every 5 seconds, when job_id is set? (does the minimum have to be 60 seconds?)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from arq.