Comments (4)
Thanks Christopher, will try this out.
from flask-apscheduler.
Can you give your job an id, and then check the jobstore for the id's status before running? Setting the max instances to 1 should prevent the scheduler from running the chron job at the same time as a user triggering the job.
https://apscheduler.readthedocs.io/en/3.x/userguide.html#adding-jobs
from flask-apscheduler.
That would be a way to prevent my manual job from running. However, the piece I need to figure out is, for the manual job, I want to run an existing scheduler job on demand. So that if the scheduled job runs, it see's a job was already started... for example...
0 mins - SpeedTest runs on schedule
5 mins - SpeedTest runs on schedule
10 mins - SpeedTest runs on schedule
14 mins - SpeedTest run manually from UX
15 mins - SpeedTest runs on schedule, see's a manual start of the same job already running and therefore doesn't run.
I need something like
scheduler.job('jobid').run()
So I can start a scheduled job whenever, irrespective of the schedule.
from flask-apscheduler.
To run a function on demand you can submit it as a "one off" job with the current time as the start time.
https://apscheduler.readthedocs.io/en/3.x/modules/triggers/date.html#module-apscheduler.triggers.date
You will have one function that setups the cron/interval job, and one function for the one-off run.
Both will call the same function and have the same id. When the job is manually triggered, before sending it to the scheduler you could check the id. I'm not 100% sure what the max instances will do when you try to add more than one (will it queue them or just ignore it?) > you can find in the docs, it is possible that the max instances will solve all the problems.
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
- 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.