Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Some jobs occasionally cannot be executed #1002

Open
3 tasks done
yuqiuwen opened this issue Dec 18, 2024 · 6 comments
Open
3 tasks done

Some jobs occasionally cannot be executed #1002

yuqiuwen opened this issue Dec 18, 2024 · 6 comments
Labels

Comments

@yuqiuwen
Copy link

Things to check first

  • I have checked that my issue does not already have a solution in the FAQ

  • I have searched the existing issues and didn't find my bug already reported there

  • I have checked that my bug is still present in the latest release

Version

3.10.4

What happened?

I defined a timed job function, and set the job_id as aps_job:pub_bp:{bp_id}. However, some job_id occasionally cannot be executed, which can be queryed in the apscheduler_jobs table. There are no errors printed.

def publish_bp(bp_id: int):
    ...

scheduler.add_job(
    publish_bp,
    id=job_id,
    name=job_id,
    args=[bp_id],
    run_date=DT.ts2time(ptime),
    misfire_grace_time=600,
)

How can we reproduce the bug?

this is apscheduler config:

SCHEDULER_JOBSTORES = {"default": SQLAlchemyJobStore(url=SQLALCHEMY_BINDS["main"])}
SCHEDULER_EXECUTORS = {
    "default": ThreadPoolExecutor(20),
    "processpool": ProcessPoolExecutor(10),
}
SCHEDULER_JOB_DEFAULTS = {
    "coalesce": False,
    "replace_existing": True,
    "max_instances": 20,
}
@yuqiuwen yuqiuwen added the bug label Dec 18, 2024
@agronholm
Copy link
Owner

If you were me, could you reproduce this issue with the information you've provided?

@yuqiuwen
Copy link
Author

If you were me, could you reproduce this issue with the information you've provided?

Actually, the scheduler was not alive using celery periodic task to test it, and there are no errors printed.

@shared_task()
def monitor_apscheduler():
    if not scheduler.running:
        logger.critical("scheduler was crashed, try restarting...")
        scheduler.start()

@agronholm
Copy link
Owner

So what do you expect me to do? If the scheduler isn't running, it's obviously not going to run your jobs. And when it restarted, isn't it likely that the misfire grace time had passed so the job was not run because of that?

@yuqiuwen
Copy link
Author

My question is that I don't know why the scheduler crashed, and why there is no log when it crashed.

@agronholm
Copy link
Owner

I don't have your computer, so how would I know that? If a Python interpreter crashes, something is always written to the log. If that's not happening, then I have nothing to work with.

@agronholm
Copy link
Owner

By the way, have you read this yet? https://apscheduler.readthedocs.io/en/3.x/userguide.html#troubleshooting

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants