Skip to content

The scheduler dosen't stop at end_time #814

Answered by agronholm
BabakAmini asked this question in Q&A
Discussion options

You must be logged in to vote

Hmm...this looks like a bug in the synchronous scheduler interface. It worked for me because I had already fixed this locally. This will be rectified in the next release.

For now, you can patch the method locally:

import logging
from zoneinfo import ZoneInfo
from functools import partial

from apscheduler import Scheduler, ScheduleRemoved
from apscheduler.triggers.cron import CronTrigger
from datetime import datetime, timedelta, timezone

logging.basicConfig()
logging.getLogger('apscheduler').setLevel(logging.DEBUG)

def fn():
    tm = datetime.now().strftime('%H:%M:%S')
    print(tm)

def listener(event: ScheduleRemoved):
    scheduler.stop()


class PatchedScheduler(Scheduler):
    def s…

Replies: 1 comment 13 replies

Comment options

You must be logged in to vote
13 replies
@BabakAmini
Comment options

@agronholm
Comment options

@BabakAmini
Comment options

@agronholm
Comment options

Answer selected by BabakAmini
@BabakAmini
Comment options

@agronholm
Comment options

@agronholm
Comment options

@BabakAmini
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants