Giter Club home page Giter Club logo

Comments (5)

everhopingandwaiting avatar everhopingandwaiting commented on June 20, 2024 3
            if os.environ.get("scheduler_lock") == "1":
                scheduler.start()
                logging.debug("Schedular Started ,-------------")
                os.environ["scheduler_lock"] = os.environ.get("scheduler_lock") + "1"

before start the program ,you had better to export scheduler_lock="1"

from flask-apscheduler.

shr-chauhan avatar shr-chauhan commented on June 20, 2024 2

Sorry for the late update
@everhopingandwaiting yea that is one way of doing it, but I am doing it differently
Running scheduler as a rpc server outside the app, so its a different process now....so whenever there is a scheduling request, it gets connected to the rpc and process the request there....

@viniciuschiele closing this

from flask-apscheduler.

viniciuschiele avatar viniciuschiele commented on June 20, 2024

yeah, your assumption is right, it will start one scheduler for each forked process and it will run the same job multiple times.
If you are running this service on multiple servers, you could keep only one active and the others as idle,
we achieved it using uwsgi legion.

from flask-apscheduler.

everhopingandwaiting avatar everhopingandwaiting commented on June 20, 2024

screenshot_2017-09-02-13-06-26-788_com sonelli juicessh

@viniciuschiele @viniciuschiele fcntl mscvrt

from flask-apscheduler.

chenxuewen avatar chenxuewen commented on June 20, 2024

Why did you add this code? Unable to dynamically modify timing tasks?

import atexit
import fcntl
from apscheduler.events import EVENT_JOB_ERROR, EVENT_JOB_MISSED, EVENT_JOB_EXECUTED
def scheduler_init(app):

f = open("scheduler.lock", "wb")
try:
    fcntl.flock(f, fcntl.LOCK_EX | fcntl.LOCK_NB)


    scheduler.add_listener(job_listener, EVENT_JOB_ERROR | \
                       EVENT_JOB_MISSED | \
                       EVENT_JOB_EXECUTED)
    scheduler.init_app(app)
    scheduler.start()
except:
    pass
def unlock():
    fcntl.flock(f, fcntl.LOCK_UN)
    f.close()
atexit.register(unlock)

from flask-apscheduler.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.