Comments (8)
Hi,
If you have your tasks in the config.py and you are using a persisted job store (sqlalchemy, mongodb...), every time you run your app Flask-APScheduler will try to add again those jobs to the job store and it will raise an error because the jobs already exist there.
from flask-apscheduler.
Should I keep the config for Flask-APScheduler in the file I create my app in?
from flask-apscheduler.
Hi,
If you want to keep your jobs in the config file you can use replace_existing: True, it will override the jobs in the job store every time your app runs.
If you don't want this behavior you can't keep the jobs in the config file.
from flask-apscheduler.
Well, maybe my issue is not with the jobs but with the Jobstore?? Because now I am running into errors when I try your examples. For example, either advanced.py
or flask_context.py
give me the error,
Traceback (most recent call last):
File "test.py", line 47, in <module>
scheduler.start()
File "C:\Anaconda3\envs\g2x_flask\lib\site-packages\flask_apscheduler\scheduler.py", line 82, in start
self._scheduler.start()
File "C:\Anaconda3\envs\g2x_flask\lib\site-packages\apscheduler\schedulers\background.py", line 33, in start
BaseScheduler.start(self, *args, **kwargs)
File "C:\Anaconda3\envs\g2x_flask\lib\site-packages\apscheduler\schedulers\base.py", line 154, in start
self._real_add_job(job, jobstore_alias, replace_existing)
File "C:\Anaconda3\envs\g2x_flask\lib\site-packages\apscheduler\schedulers\base.py", line 851, in _real_add_job
store.add_job(job)
File "C:\Anaconda3\envs\g2x_flask\lib\site-packages\apscheduler\jobstores\sqlalchemy.py", line 94, in add_job
raise ConflictingIdError(job.id)
apscheduler.jobstores.base.ConflictingIdError: 'Job identifier (job1) conflicts with an existing job'
It works the first time it runs, but then when I run the script again that is when I get the error, with advanced.py
this happens when I change from url='sqlite://'
to something persistant, ie url='sqlite://.test.db'
Is there something I am doing wrong running your examples?
Also, I am not even sure if this is an issue with your package since the errors seem to be coming from apscheduler and not flask-apscheduler?
from flask-apscheduler.
It doesn't work, you can't put your jobs in the config file and use a persisted job store because every time you run your app it will try to add your jobs in the job store.
An alternative would be using replace_existing: True
from flask-apscheduler.
I see. What is the point of having a job in a database? Is it even required?
from flask-apscheduler.
For example, if you have a job to run every hour and the next trigger is 14:00, if for some reason you had to stop and start your app 5 minutes before (like 13:55), the next trigger is going be 14:55 and not 14:00 as before.
That would happen if you didn't use a persistent job store, It may be an issue in some scenarios.
from flask-apscheduler.
Feel free to reopen it again if you need it.
from flask-apscheduler.
Related Issues (20)
- 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
- python3-flask-APScheduler_1.13.0.bb HOT 4
- Can I use hive database to restore jobs? HOT 2
- Coroutine as argument
- use api add task func which is not defined in the app start script failed HOT 2
- alembic migrations
- ModuleNotFoundError: No module named 'flask_apscheduler' HOT 2
- Adding a pyproject.toml to ensure compliance with updates to pip
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.