Skip to content
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

global misfire_grace_time does not work #6

Closed
agronholm opened this issue Dec 2, 2010 · 6 comments
Closed

global misfire_grace_time does not work #6

agronholm opened this issue Dec 2, 2010 · 6 comments

Comments

@agronholm
Copy link
Owner

Originally reported by: Anonymous


The default misfire_grace_time value for a job is set 1 in Job.init():

#!python
class Job(object):
    def __init__(self, trigger, func, args, kwargs, name=None,
                 misfire_grace_time=1, max_runs=None, max_concurrency=1):

So the following code in Schedule.add_job() does not work:

#!python

class Scheduler(object):
    def add_job():
        ...
        job = Job(trigger, func, args or [], kwargs or {}, **options)
        if job.misfire_grace_time is None:
            job.misfire_grace_time = self.misfire_grace_time
        ...

@agronholm
Copy link
Owner Author

Original comment by Alex Grönholm (Bitbucket: agronholm, GitHub: agronholm):


Please explain. Why would it not work?

@agronholm
Copy link
Owner Author

Original comment by Alex Grönholm (Bitbucket: agronholm, GitHub: agronholm):


Closing as the rationale is invalid and my question was left unanswered.

@maxskorr
Copy link

the problem still occurs

@agronholm
Copy link
Owner Author

Please elaborate. "Does not work" is not a good description.

@maxskorr
Copy link

The parameter has no effect when passed to Scheduler.add_job, whereas seem to work fine if configured with configure()

@agronholm
Copy link
Owner Author

Please run the following script and tell me which value it prints: 3 (the scheduler default) or 4 (the per-job value):

from apscheduler.schedulers.background import BackgroundScheduler

scheduler = BackgroundScheduler(misfire_grace_time=3)
scheduler.start()
job = scheduler.add_job(lambda: None, 'interval', seconds=60, misfire_grace_time=4)
print(job.misfire_grace_time)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants