TanmoySG / wunder-identity-provider

ID Provider for Wunder Platform. Authentication & Authorization Server for all wunder products
3 stars 0 forks source link

[Sub Component] Operation Scheduling #30

Open TanmoySG opened 2 years ago

TanmoySG commented 2 years ago

Scheduled Operation calls within the Flask App can help in performing certain template-operations without the need of Admin-System Interface.

[Parent/Related Component]

29

AuthLib Maintenance can use scheduled function calls / scheduled operations.

[Checkpoints]

[Additional Details]

Can use APScheduler for in-script scheduling as an alternative to Cron Jobs.

A Sample Implementation of it can be found on this GutHub Gist.

import flask
from apscheduler.schedulers.background import BackgroundScheduler

def scheduled_function():
    print("Scheduled Function Called")

sched = BackgroundScheduler(daemon=True)
sched.add_job(scheduled_function,'interval',seconds=20)
sched.start()

app = flask.Flask(__name__)

@app.route("/home") 
def hello_world(): 
    return "<p>Hello, World!</p>"

Documentation