Comments (5)
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.
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.
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.
@viniciuschiele @viniciuschiele fcntl mscvrt
from flask-apscheduler.
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)
- `scheduler.resume_job` failed to work
- Question about use the gunicorn to deploy flask-apsscheduler? HOT 1
- [PLS HELP] Flask-Appbuilder - accessing scheduler from views.py HOT 2
- ModuleNotFoundError: No module named 'scheduler' HOT 2
- The task is interrupted inexplicably
- Trying to run a function as a schedule and also trigger on demand HOT 4
- Flask-APScheduler not running when set some environment variables HOT 3
- Running job causes detachedinstanceerror HOT 3
- Use Codecov in informational mode HOT 1
- APScheduler not working with gunicorn eventlet HOT 6
- Flask 2.3.2 causing KeyError: 'JSONIFY_PRETTYPRINT_REGULAR' HOT 1
- Flask-APScheduler multiple jobs running at the same time when having multiple workers HOT 1
- [RFE] Package python3-flask-apscheduler into RPM
- KeyError: 'JSONIFY_PRETTYPRINT_REGULAR' when running Flask as a development server HOT 2
- Apscheduler not working with flask debug=True & --no-reload
- Flask 3.0.0 support HOT 1
- Behaviour of processpool HOT 1
- Key Error while passing redis instance as arg HOT 2
- Can't start BlockingScheduler as daemon in debug mode
- Issue with sqlalchemy (cannot join current thread and working outside of app context) HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flask-apscheduler.