-
Notifications
You must be signed in to change notification settings - Fork 185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can we run multiple APScheduler jobs parallely? #38
Comments
Hi @mrabhiram Your jobs above are running parallely, each job runs on its own thread, the default is 10 max concurrent threads. This code below (python 3+) shows that each job is running in a different thread. import threading
def job1(a, b):
print(threading.current_thread().name)
print(str(a) + ' ' + str(b)) |
Okay, Thank you. Can i change the max concurrent threads? if so , where do i do that? |
You have to explicitly set an executor in your config object. class Config(object):
JOBS = [
{
'id': 'job1',
'func': 'jobs:job1',
'args': (1, 2),
'trigger': 'interval',
'seconds': 10
},
{
'id': 'job2',
'func': 'jobs:job1',
'args': (3, 4),
'trigger': 'interval',
'seconds': 10
}
]
SCHEDULER_EXECUTORS = {
'default': {'type': 'threadpool', 'max_workers': 20}
}
SCHEDULER_API_ENABLED = True |
Thank you. Can many workers is the max that APScheduler can handle? Or the max is only 20? |
There isn't a limit for the number of workers, it's up to you. |
Awesome. Thanks! |
The way I see it right now, if i define two or more jobs, they are running sequentially. Is there a way we can run multiple jobs parallely?
Right now the two jobs defined(job1 and job2) are running one after another. Is there a way to execute them individually and parallely?
The text was updated successfully, but these errors were encountered: