Questions tagged [apscheduler]

Advanced Python Scheduler (APScheduler) is a light but powerful in-process task scheduler that lets you schedule functions (or any other python callables) to be executed at times of your choosing.

Introduction

Advanced Python Scheduler (APScheduler) is a light but powerful in-process task scheduler that lets you schedule functions (or any other python callables) to be executed at times of your choosing.

This can be a far better alternative to externally run cron scripts for long-running applications (e.g. web applications), as it is platform neutral and can directly access your application’s variables and functions.

The development of APScheduler was heavily influenced by the Quartz task scheduler written in . APScheduler provides most of the major features that Quartz does, but it also provides features not present in Quartz (such as multiple job stores).

Features

  • No (hard) external dependencies
  • Thread-safe API
  • Excellent test coverage (tested on 2.4 - 2.7, 3.1 - 3.2, 2.5.2, 1.4.1 and 1.5)
  • Configurable scheduling mechanisms (triggers):
    • -like scheduling
    • Delayed scheduling of single run jobs (like the UNIX at command)
    • Interval-based (run a job at specified time intervals)
  • Multiple, simultaneously active job stores:

Reference

740 questions
114
votes
8 answers

RuntimeError: There is no current event loop in thread in async + apscheduler

I have a async function and need to run in with apscheduller every N minutes. There is a python code below URL_LIST = ['', '', '', ] def demo_async(urls): """Fetch list of web pages…
Valera Shutylev
  • 1,145
  • 2
  • 7
  • 6
56
votes
5 answers

apscheduler in Flask executes twice

I have problem when i am using apscheduler in my flask application. In my view.py file i am writing like this import time from apscheduler.scheduler import Scheduler def test_scheduler(): print "TEST" print time.time() sched =…
Beka Tomashvili
  • 2,171
  • 5
  • 21
  • 27
48
votes
3 answers

Make sure only one worker launches the apscheduler event in a pyramid web app running multiple workers

We have a web app made with pyramid and served through gunicorn+nginx. It works with 8 worker threads/processes We needed to jobs, we have chosen apscheduler. here is how we launch it from apscheduler.events import EVENT_JOB_EXECUTED,…
Ranjith Ramachandra
  • 10,399
  • 14
  • 59
  • 96
35
votes
1 answer

How to run recurring task in the Python Flask framework?

I'm building a website which provides some information to the visitors. This information is aggregated in the background by polling a couple external APIs every 5 seconds. The way I have it working now is that I use APScheduler jobs. I initially…
kramer65
  • 50,427
  • 120
  • 308
  • 488
32
votes
4 answers

python apscheduler - skipped: maximum number of running instances reached

I am executing a function every second using Python apscheduler (version 3.0.1) code: scheduler = BackgroundScheduler() scheduler.add_job(runsync, 'interval', seconds=1) scheduler.start() It's working fine most of the time but sometimes I get this…
boyfromnorth
  • 958
  • 4
  • 19
  • 41
25
votes
1 answer

Locking a method in Python?

Here is my problem: I'm using APScheduler library to add scheduled jobs in my application. I have multiple jobs executing same code at the same time, but with different parameters. The problem occurs when these jobs access the same method at the…
DanijelT
  • 351
  • 1
  • 3
  • 3
22
votes
2 answers

Querying model in Flask-APScheduler job raises app context RuntimeError

I want to run a job with Flask-APScheduler that queries a Flask-SQLAlchemy model. When the job runs, I get RuntimeError: application not registered on db instance and no application bound to current context. How can I run a job that queries the…
Tone
  • 223
  • 2
  • 5
19
votes
1 answer

next run time missed by some seconds in job scheduling in apscheuler

i have a function to execute cron job as def add_config_job(sched, job): module = JOB_METHODS.get(job["type"]) if module is None: logging.warn("job type %r not supported", job["type"]) return func = module.cron_job …
user3545251
  • 445
  • 3
  • 6
  • 15
14
votes
3 answers

python apschedule BlockingScheduler with interval trigger: Start immediately

I am using python apscheduler to schedule a specific task every 45 minutes. The problem is, when i add the job and start the scheduler, it starts at 45 minutes from now. from apscheduler.schedulers.blocking import BlockingScheduler class myClass: …
user4493177
  • 750
  • 11
  • 32
13
votes
4 answers

APScheduler how to trigger job now

I have an APScheduler in a Flask app, sending events at some intervals. Now i need to "refresh" all jobs, in fact just starting them now if they don't run without touching on the defined interval. I'v tried to call job.pause() then job.resume() and…
dashie
  • 303
  • 1
  • 2
  • 11
13
votes
2 answers

APScheduler options

I'm trying to schedule programmatically some jobs with Advace Python Scheduler, my problem is that in the documentation it is only mentioned how to schedule with 'interval' trigger type, what about 'cron' and 'date'. Is there any complete…
tbo
  • 9,398
  • 8
  • 40
  • 51
12
votes
1 answer

Django run tasks (possibly) in the far future

Suppose I have a model Event. I want to send a notification (email, push, whatever) to all invited users once the event has elapsed. Something along the lines of: class Event(models.Model): start = models.DateTimeField(...) end =…
Hafnernuss
  • 2,659
  • 2
  • 29
  • 41
12
votes
2 answers

APScheduler missing jobs after adding misfire_grace_time

I am running a BlockingScheduler process that it's suppose to run several cron jobs, but it fails to run every single time with the message: Run time of job "validation (trigger: cron[hour='3'], next run at: 2016-12-30 03:00:00 CST)" was missed by…
PepperoniPizza
  • 8,842
  • 9
  • 58
  • 100
12
votes
4 answers

Python APScheduler how to disable logging

I set up APScheduler to run every second via cron schedule (kind of needed/wanted). Right now I have logger sending everything to console. If it wasn't for logging is greatly important to what I'm working on, it'd be okay. But, I need logging. …
Eric Hansen
  • 193
  • 1
  • 2
  • 8
11
votes
3 answers

Python APScheduler - How does AsyncIOScheduler work?

I'm having a hard time understanding how the AsyncIOScheduler works, and how is it non blocking? If my job is executing a blocking function, will the AsyncIOScheduler be blocking? And what if I use AsyncIOScheduler with ThreadPoolExecutor? How does…
Mojimi
  • 2,561
  • 9
  • 52
  • 116
1
2 3
49 50