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

APScheduler running a Python Script

I have a python script which is a scraper. I want it to run every 10 minutes. Currently it is in its own docker container and with EntryPoint to a python file. def main(): scheduler = BlockingScheduler() scheduler.add_job(scraper,…
user6723321
0
votes
0 answers

APScheduler not executing the job at the specified time

I wrote a code to gather data in 1 hour intervals from 12 o'clock, from an online source. I have Python 2.7.12 on Mac with APScheduler of version 3.3.0. My code consist of two functions as below: 1- Main Function which is executed every 1 hour…
Amir H
  • 115
  • 12
0
votes
1 answer

How to restore APSchduelder sqlite to Postgres

I am migrating from sqlite to postgres. Here is dumpfile.sql PRAGMA foreign_keys=OFF; BEGIN TRANSACTION; CREATE TABLE apscheduler_jobs ( id VARCHAR(191) NOT NULL, next_run_time FLOAT, job_state BLOB NOT NULL, PRIMARY KEY (id) ); I…
joe
  • 8,383
  • 13
  • 61
  • 109
0
votes
2 answers

how to make apscheduler forever in linux

I want to run apscheduler forever in Linux But. The apscheduler not work when I close the terminal. here is my code from apscheduler.schedulers.background import BackgroundScheduler from datetime import datetime def tick(): text = 'Tick! The…
bing
  • 1
  • 2
0
votes
1 answer

Why won't this APScheduler code work?

been looking for quite a while for an answer so I turned to here! It gives me the error, "Invalid Index" for the sched.start()! import random import datetime from apscheduler.schedulers.blocking import BlockingScheduler import smtplib import…
Mhyles
  • 21
  • 1
  • 1
  • 4
0
votes
1 answer

APScheduler - ImportWarning but code still runs. What is wrong?

My code follows the example from APScheduler Docs but I changed its format to follow mine. It works no problem. "Hello World" is printed every 10 seconds. #! /usr/bin/python import datetime from apscheduler.schedulers.blocking import…
Nick Bonne
  • 75
  • 7
0
votes
1 answer

When using PyMongo, No handlers could be found for logger "apscheduler.scheduler"

The code works fine printing to screen hello every second. This is done using the bar method, which is added to the scheduler as a job. Problem: However when the line self.db.animals.insert_one({'name': 'lion'}) is added to the bar method, running…
Nyxynyx
  • 61,411
  • 155
  • 482
  • 830
0
votes
1 answer

How does APScheduler save the jobs in the database? (Python)

I am trying to figure out how looks the schema of a sqlite database after I save some jobs using Advanced Python Scheduler. I need it because I want to show the job in a UI. I tried to write a simple script which saves a job : from pytz import…
Vasile
  • 801
  • 2
  • 13
  • 31
0
votes
1 answer

Run paho mqtt client loop_forever

I am trying to run the following code on loop continuously. But the following code only runs once and takes only one message entry. What i a trying to do inside the on_message function is run a cron task using python apscheduler. def…
user5876854
  • 19
  • 1
  • 4
0
votes
1 answer

How can I schedule a script to run every 46 minutes, between 6:00 am and 23:40pm, daily with python?

I need a script to run every 46 minutes, between 6:00 am and 23:40pm, daily. Im currently using apscheduler, but I'm failing to set up the 24 runs per day on interval schedule, and programming each one of the run with a cron mode seems highly…
Silver
  • 211
  • 2
  • 11
0
votes
1 answer

Apscheduler Job Serialization not working

We are setting up a scheduler based on Apscheduler, the problem is we are not able to serialize the Jobs. Here's a structure of what we want. A class Base, with its method, this is the class to be run class Base(object): def __init__(self,…
kaizer
  • 490
  • 1
  • 6
  • 17
0
votes
1 answer

APScheduler job still runs once it added to scheduler when exceeding the max_worker number

I had a script that periodically logged on a certain linux server using ssh and the maximum connection number of the server is 13, so I set parameter max_workers 10. But I found when scheduling jobs in background, it failed to connect to the linux…
J.Wang
  • 1,241
  • 3
  • 13
  • 17
0
votes
1 answer

apscheduler interval task is not running on aws

I would like to fire my job every few minutes. It is working on my local machine. However, on AWS Elastic Beanstalk the job never fires. I use python 3.4, apscheduler 3.1.0 and Flask 0.10.1. For instance: from apscheduler.schedulers.background…
0
votes
2 answers

How to add jobs to threadpool with APScheduler

I am new to APScheduler For testing I have set the max_worker=2 and added 4 different jobs to scheduler. I intended to run 2 jobs in parallel because of the limitation of threadpool, I thought that after finishing certain job another added job will…
J.Wang
  • 1,241
  • 3
  • 13
  • 17
0
votes
1 answer

APScheduler on a single EC2 instance getting called multiple times

I have a Flask application that's deployed on a single AWS EC2 instance. In my __init__.py file I've instantiated a BackgroundScheduler with a job scheduled to run at every 1 hour interval. Here's an example of my __init__.py code: application =…
nicknaky
  • 11
  • 2