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
7
votes
1 answer

APScheduler how to add job outside the scheduler?

I have a simple requirement. I am running apscheduler as a separate process. I have another jobproducer script from where I want to add a job to the scheduler and run it. This is my scheduler code, # appsched.py from apscheduler.schedulers.blocking…
Mayur Rokade
  • 512
  • 7
  • 20
7
votes
1 answer

Running ApScheduler in Gunicorn Without Duplicating Per Worker

The title basically says it all. I have gunicorn running my app with 5 workers. I have a data structure that all the workers need access to that is being updated on a schedule by apscheduler. Currently apscheduler is being run once per worker, but I…
Eli
  • 36,793
  • 40
  • 144
  • 207
7
votes
1 answer

How to detect APScheduler's running jobs?

I have some recurring jobs run frequently or last for a while. It seems that Scheduler().get_jobs() will only return the list of scheduled jobs that are not currently running, so I cannot determine if a job with certain id do not exists or is…
kkzxak47
  • 462
  • 7
  • 16
7
votes
1 answer

Error in `/usr/bin/python': double free or corruption (out): 0x00007f7c3c017260

I'm developing a website in Python using the (excellent) Flask framework. In the backend code I use APScheduler to run some cron-like jobs every minute, and I use Numpy to calculate some Standard Deviations. Don't know whether the usage of these…
kramer65
  • 50,427
  • 120
  • 308
  • 488
6
votes
3 answers

Python APScheduler fails: 'Only timezones from the pytz library are supported' error

I am trying to run a python async app with an asyncioscheduler scheduled job but the APScheduler fails during build because of this error: 'Only timezones from the pytz library are supported' error I do include pytz in my app and i am passing the…
KZiovas
  • 3,491
  • 3
  • 26
  • 47
6
votes
3 answers

How to use APScheduler in Python to run program daily at exact time?

I am trying to run something at the exact time to the second everyday. I have tried Schedule and used a sleep time of 1 second but it runs twice sometimes so I want to switch to APScheduler. But I have never used anything Cron like before and their…
Luluz
  • 63
  • 1
  • 4
6
votes
1 answer

APScheduler shut down randomly

Scheduler running fine in production, then all of a sudden it shut down. Clearly DB might have been offline for a bit (web apps never missed a beat so it was transient). Log reported... [2019-11-25 07:59:14,907: INFO/ercscheduler] Scheduler has…
LiteWait
  • 584
  • 4
  • 21
  • 42
6
votes
1 answer

Flask APScheduler + Gunicorn workers - Still running task twice after socket fix

I have a Flask app where i use Flask-APScheduler to run a scheduled query on my database and send an email via a cron job. I'm running my app via Gunicorn with the following config and controlled via…
br0cky
  • 223
  • 3
  • 11
6
votes
1 answer

What is the difference between 'Interval' and 'Cron' triggers in APScheduler?

I am using APScheduler for my project. I went through APScheduler documentation. But I am not able to understand what is actual difference between 'Interval' and 'cron' triggers. Following definition was given in docs: interval: use when you want…
Shiva Verma
  • 89
  • 2
  • 9
6
votes
1 answer

python apscheduler not consistent

I'm running a scheduler using python apscheduler inside web.py framework. The function runserver is supposed to run everyday at 9 a.m but it is inconsistent. It runs most days but skips a day once in a while. Code: import web from…
boyfromnorth
  • 958
  • 4
  • 19
  • 41
6
votes
1 answer

Python Apscheduler - Schedule Jobs dynamically (nested)

We have a requirement to schedule multiple jobs dynamically while current job is executing. Approximate Scenario is: There should be a scheduler to go through a table of application daily basis (assume at 6 AM UTC). Find the users who has…
Laxmikant
  • 2,046
  • 3
  • 30
  • 44
6
votes
4 answers

Python - Apscheduler not stopping a job even after using 'remove_job'

This is my code I'm using the remove_job and the shutdown functions of the scheduler to stop a job, but it keeps on executing. What is the correct way to stop a job from executing any further? from apscheduler.schedulers.background import…
wolfgang
  • 7,281
  • 12
  • 44
  • 72
6
votes
1 answer

How to use Flask-APScheduler in existed Flask app

I am trying to get familiar with Flask-APScheduler plug-in through the following sample code: https://github.com/viniciuschiele/flask-apscheduler/blob/master/examples/jobs.py#L1 My project has the following structure: backend run.py …
user706838
  • 5,132
  • 14
  • 54
  • 78
6
votes
2 answers

How to set Python apscheduler run job at 9,11,14,17,18 clock everyday

I am working on a period task with Python apscheduler, I want the code execute on 9:00, 11:00, 16:00, 17:00 every day and here is an example code for the job: #coding=utf-8 from apscheduler.schedulers.blocking import BlockingScheduler import…
lqhcpsgbl
  • 3,694
  • 3
  • 21
  • 30
6
votes
2 answers

Python 3 - Global Variables with AsyncIO/APScheduler

Been struggling with this for a while. Based on this thread: Using global variables in a function other than the one that created them I should be able to update the variable used by thread_2 by scheduling a task at certain times. The code: import…
1 2
3
49 50