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
6
votes
6 answers

No trigger by the name "interval" was found

I've been working with APScheduler and when attempting to run the code I get the error "No trigger by the name 'interval' was found" It was perfectly on my local machine but will work on my cloud machine. I have tried: reinstalling apscheduler via…
ik629
  • 125
  • 2
  • 10
6
votes
1 answer

How do I run APScheduler inside a Windows service...I'm almost there

I'm working on a project to run Python APScheduler as a Windows Service with the results going to a text file. I can install and start the service without a hitch. I've tried a couple of ways of running the scheduler inside a service with the most…
6
votes
1 answer

How to use Tornado with APScheduler?

I am running python's apscheduler and periodically want to do some work POST-ing to some http resources which will involve using tornado's AsyncHttpClient as a scheduled job. Each job will do several POSTs. When each http request responds a…
Rocketman
  • 3,464
  • 5
  • 27
  • 30
6
votes
1 answer

NameError: global name 'create_engine' is not defined [when trying to create a SQLAlchemyJobStore]

I am trying to add a SQLAlchemyJobStore job store (and make it the default job store) and store some jobs on it. I am running mysql which has a database named jobstore. I have the following program which tries to open a SQLAlchemyJobStore job store…
Sangeeth Saravanaraj
  • 16,027
  • 21
  • 69
  • 98
5
votes
1 answer

How to use ApScheduler correctly in FastAPI?

from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware import uvicorn import time from loguru import logger from apscheduler.schedulers.background import BackgroundScheduler app = FastAPI() app.add_middleware( …
jianyi
  • 151
  • 1
  • 3
  • 11
5
votes
3 answers

Django app with multiple instances - how to ensure daily email is only sent once?

I am building a Django app that uses APScheduler to send out a daily email at a scheduled time each day. Recently the decision was made to bump up the number of instances to two in order to always have something running in case one of the instances…
jtbrubak
  • 51
  • 3
5
votes
2 answers

Scheduling a cron job in python to run a python script every day at 10 am through APSCHEDULER

I want to schedule a cron job in python that runs a python script every day at 10 am. I am using apscheduler to achieve this functionality. I am trying to use apscheduler functionality to schedule a cron job that runs every day at 10 am and executes…
Nakul Sharma
  • 143
  • 2
  • 9
5
votes
0 answers

One or more mappers failed to initialize - can't proceed with initialization of other mappers

I am using sqlalchemy orm automap to map my existing mysql tables. And I am using three databases with cross relationship between the databases in my project. I have three DBHandler class. One of the handler is shown below, class…
Atul K.
  • 352
  • 1
  • 6
  • 16
5
votes
1 answer

Sending python-socket.io message from an APScheduler job causes client to hang

I'm using APScheduler in my application to schedule jobs, and python-socket.io to communicate with a browser client to notify it of jobs being executed. However, I'm finding that the socket.io client (regular JavaScript client) doesn't accept events…
southrop
  • 819
  • 10
  • 19
5
votes
2 answers

Apscheduler is executing job multiple times

I have a django application running with uwsgi (with 10 workers) + ngnix. I am using apscheduler for scheduling purpose. Whenever i schedule a job it is being executed multiple times. From these answers ans1, ans2 i got to know this is because the…
daemon24
  • 1,388
  • 1
  • 11
  • 23
5
votes
1 answer

python: APScheduler in WSGI app

I would like to run APScheduler which is a part of WSGI (via Apache's modwsgi with 3 workers) webapp. I am new in WSGI world thus I would appreciate if you could resolve my doubts: If APScheduler is a part of webapp - it becomes alive just after…
KoDPI
  • 53
  • 4
5
votes
1 answer

APScheduler - job not executed

I'm new to APScheduler and testing it before implementing it in a larger scope. I have created the code below, but somehow my functions are never called when I use add_job with trigger='date'. If I use trigger='interval', then everything works fine.…
koko
  • 51
  • 1
  • 3
5
votes
1 answer

How to get the previous run time in APScheduler?

I know there's job.next_run_time to get the next run, but anyway to calculate what would have been the previous run time?
Romey-Rome
  • 91
  • 1
  • 8
5
votes
1 answer

Scaling APScheduler

I want to run multiple instances of APScheduler pointing to one common persistent job DB. Is it possible to run in that way?? I also mean that the jobs in the DB get shared among the Scheduler instances and at a point there is only one instance…
polavishnu
  • 141
  • 2
  • 9
5
votes
1 answer

passing current object to python apscheduler method

I'm trying to schedule a job every X hours within a class. However I'm not sure how to pass the current context to the method, since it requires "self". I know that if do it cron-style, i can use an args argument list, but that hasn't worked either.…
L-R
  • 1,214
  • 1
  • 19
  • 40