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
4
votes
3 answers

Can we force run the jobs in APScheduler job store?

Using APScheduler version 3.0.3. Services in my application internally use APScheduler to schedule & run jobs. Also I did create a wrapper class around the actual APScheduler(just a façade, helps in unit tests). For unit testing these services, I…
amrx
  • 673
  • 1
  • 9
  • 23
4
votes
1 answer

How to relate APScheduler JobStore with SQLAlchemy Models (foreign key) - Python Flask

I've got a Python Flask app using flask.ext.sqlalchemy and apscheduler.schedulers.background. I've created a JobStore and gotten a table called apscheduler_jobs is has the following fields: |id …
edumike
  • 3,149
  • 7
  • 27
  • 33
4
votes
1 answer

Single apscheduler instance in Flask application

Setup: Flask application running in Apache's httpd via wsgi Single wsgi process with 25 threads: WSGIDaemonProcess myapp threads=25 apscheduler to run jobs (send emails) RethinkDB as the backend for the job store I'm trying to prevent apscheduler…
wspeirs
  • 1,321
  • 2
  • 11
  • 22
4
votes
2 answers

How to make Python apscheduler run in background

I want to make Python apscheduler run in background , here is my code: from apscheduler.schedulers.background import BackgroundScheduler, BlockingScheduler from datetime import datetime import logging import…
lqhcpsgbl
  • 3,694
  • 3
  • 21
  • 30
4
votes
1 answer

How to use APscheduler with scrapy

have this code who run scrapy crawler from script(http://doc.scrapy.org/en/latest/topics/practices.html#run-scrapy-from-a-script). But it doesn't work. from twisted.internet import reactor from scrapy.crawler import Crawler from scrapy import…
kzr
  • 41
  • 1
  • 5
4
votes
2 answers

No handlers could be found for logger "apscheduler.executors.default"?

I have a python script being run via a nightly job on Heroku. Every once in a while (and lately, a lot more), the script fails to execute due to the below error. 2015-02-25T05:00:02.671242+00:00 app[clock.1]: No handlers could be found for logger…
carbon_ghost
  • 1,114
  • 5
  • 18
  • 40
4
votes
1 answer

apscheduler interval task is not running

I would like to have my main task fire at 6am everyday. but for testing purposes I set the interval to 5 seconds. The problem is it doesn't seem to ever fire. I have a break point in the maintask method that is never reached and nothing gets printed…
TheColonel26
  • 2,618
  • 7
  • 25
  • 50
4
votes
1 answer

How to end APScheduler job after set number of seconds?

I use APScheduler to schedule a job which calls an API every minute. I now get a massive error which ends with: File "/usr/lib/python2.7/httplib.py", line 1045, in getresponse response.begin() File "/usr/lib/python2.7/httplib.py", line 409,…
kramer65
  • 50,427
  • 120
  • 308
  • 488
4
votes
0 answers

Testing APScheduler locally with Foreman

I use foreman to run my python app locally and test it. This is what I do: foreman start -e local.env I'm trying to add scheduling to my app, so I installed apscheduler and followed the tutorial on Heroku. I added this line to my Procfile: clock:…
lawicko
  • 7,246
  • 3
  • 37
  • 49
4
votes
1 answer

Adding periodic tasks dynamically from flask app

I have a flask web app deployed in heroku. I need to schedule a background task to be scheduled at a specific time. I have tried using the apscheduler module. While it allows to define periodic tasks easily adding them from your application at…
4
votes
1 answer

Capture logs in apscheduler

How do I capture logs inside a job from apscheduler? Assume, I have the following job @sched.interval_schedule(hours=3) def some_job(): log.info('I was here.') log.info('And here.') And a listener sched.add_listener(job_listener, …
dominik
  • 5,745
  • 6
  • 34
  • 45
3
votes
1 answer

uwsgi web app with cron tasks?

I wrote an app using webpy (webpy.org). Part of this web app is recurring background tasks for statistical functions. I used APScheduler python library to perform cron style schedules. Because app.run() let webpy run in standalone mode during…
He Shiming
  • 5,710
  • 5
  • 38
  • 68
3
votes
1 answer

Submit worker functions in dask distributed without waiting for the functions to end

I have this python code that uses the apscheduler library to submit processes, it works fine: from apscheduler.schedulers.background import BackgroundScheduler scheduler = BackgroundScheduler() array = [ 1, 3, 5, 7] for elem in array: …
ps0604
  • 1,227
  • 23
  • 133
  • 330
3
votes
1 answer

How to call function from class in apscheduler job?

I have a class that has triggers, and I'd like to update these triggers when the job hit the proper time. My class: class SetTrigger(object): def __init__(self): self.set_work = False self.set_reload = False …
Guilherme Matheus
  • 573
  • 10
  • 30
3
votes
1 answer

Python Apscheduler Loop Without Overlapping Tasks

I'm trying to work with Apscheduler to run 3 tasks sequentially, but I'm having a challenge figuring out how to prevent overlapping of tasks before the whole cycle is completed. import time from apscheduler.schedulers.blocking import…
CoderS
  • 143
  • 1
  • 8