Python Forum
How can i use max_instances in apscheduler - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: How can i use max_instances in apscheduler (/thread-19959.html)



How can i use max_instances in apscheduler - zebisnaga - Jul-21-2019

Hi, guys
I am working with 3 scripts. The first one does a request, save the data from the request and write in a csv file.
The second one is a flask app that recieves that csv and display it in a table.
The third is a clock that repeats the first script from time to time.
My problem is in the third script... i am using heroku and i cant use scheduler ... my current code is like this.
from apscheduler.schedulers.blocking import BlockingScheduler
from trainsScript import *

sched = BlockingScheduler()
@sched.scheduled_job(trigger='interval', seconds=3 ,max_instances=15)
def trains():
    try:
        data = list(getRequest())
        getTrain(data)
        print('updating 5 seconds')
    except:
        print('ERROR BRUNO')

sched.start()