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
0 answers

APScheduler: How to stop a job which has not finished after a certain time?

My main script looks like this: if __name__ == "__main__": scheduler = BlockingScheduler() scheduler.add_job(job_x,'cron',id="job_x",day_of_week="tue", hour=11, minute=49, jobstore="default") …
An old man in the sea.
  • 1,169
  • 1
  • 13
  • 30
4
votes
1 answer

How to use AsyncIOScheduler to run function from another function?

I'm having difficulty to understand how the AsyncIOScheduler works and how I can schedule a function inside the main function, or how is the proper way to do that. How can I run the function foo every 10 seconds? Suppose I have this…
Guilherme Matheus
  • 573
  • 10
  • 30
4
votes
0 answers

Apache restart every midnight by itself causing apscheduler task to not complete

Hi I have a Pyramid wsgi webapp served using Apache. The webapp has an hourly job that must be run at the 0th min to fetch time-sensitive data and write to my mysql database. I note that sometimes (not all times) the data might not be written into…
minovsky
  • 857
  • 1
  • 15
  • 28
4
votes
3 answers

ModuleNotFoundError: No module named 'apscheduler'

it might be a silly problem. I have no idea about why I am facing ModuleNotFoundError: No module named 'apscheduler' but I have already successfully installed APscheduler. I have tried uninstalling it and re-install the specific version of…
Zhaojun
  • 41
  • 1
  • 2
4
votes
1 answer

APScheduler:Trigger New job after completion of previous job

I'm using APScheduler(3.5.3) to run three different jobs. I need to trigger the second job immediately after the completion of first job. Also I don't know the completion time of first job.I have set trigger type as cron and scheduled to run every 2…
Dinesh
  • 1,135
  • 2
  • 15
  • 22
4
votes
1 answer

Apscheduler+scrapy signal only works in main thread

i want to combine apscheduler with scrapy.but my code is wrong. How should i modify it? settings = get_project_settings() configure_logging(settings) runner = CrawlerRunner(settings) @defer.inlineCallbacks def crawl(): reactor.run() yield…
馮推宇
  • 121
  • 1
  • 1
  • 3
4
votes
0 answers

Schedule jobs dynamically with Flask APScheduler

I'm trying the code given at advanced.py with the following modification for adding new jobs. I created a route for adding a new job @app.route('/add', methods = ['POST']) def add_to_schedule(): data = request.get_json() print(data) d…
4
votes
2 answers

How to run an apscheduler job which requires app_context

I have a flask app which needs to run some of the methods as background tasks. I have been trying to use apscheduler. Background tasks which do not require app_context run without issue, however, tasks which do require it always throw an…
Andrew Gill
  • 361
  • 1
  • 14
4
votes
1 answer

Windows 10 run python program in startup

I have written a python program that periodically runs with ApScheduler package. The .pyw file runs in the background, but when I restart the PC the program doesn't continue running. What can I do to run a code automatically in startup a windows 10…
4
votes
1 answer

Distributed task scheduler in python?

I would like to build an app, which would call periodic tasks at defined intervals - cron replacement like, but without spawning processes. I'll have a lot of tasks, around 10000 per minute. I should be able to add tasks to scheduler dynamically,…
Josh
  • 81
  • 1
  • 3
  • 7
4
votes
1 answer

How to use apscheduler to trigger job at specific times?

I am using python apscheduler module to trigger job at irregular intervals for example at 1:30 AM and 11:10 PM on every day, but not able to find a solution to this. Could you please help me how to do it. I don't want to create two jobs, one for…
user2753523
  • 473
  • 2
  • 8
  • 23
4
votes
2 answers

ISSUES Defining Cron jobs in Procfile (Heroku) using apscheduler for Django project

I am having a problem scheduling a cron job which requires scraping a website and storing it as part of the model (MOVIE) in the database. The problem is that the model seems to get loaded before Procfile is executed. How should I create a cron…
curiousDog
  • 83
  • 1
  • 8
4
votes
1 answer

Send scheduled emails with pyramid_mailer and apscheduler

I've tried getting this to work but there must be a better way, any input is welcome. I'm trying to send scheduled emails in my python pyramid app using pyramid_mailer (settings stored in .ini file), and apscheduler to set the schedule. I also use…
Niel
  • 1,856
  • 2
  • 23
  • 45
4
votes
1 answer

APScheduler Job not running after restart

I trying the MongoJobStore example of APS. The example code is: import logging import os import sys from datetime import datetime, timedelta from apscheduler.schedulers.blocking import BlockingScheduler logging.basicConfig() def alarm(time): …
Abhishek Gupta
  • 6,465
  • 10
  • 50
  • 82
4
votes
1 answer

apscheduler with mongodb

I'm trying to run this code: from pytz import utc from apscheduler.schedulers.background import BackgroundScheduler from apscheduler.jobstores.mongodb import MongoDBJobStore jobstores = { 'default': MongoDBJobStore(database='apscheduler',…
Aviv Noy
  • 526
  • 2
  • 7
  • 20