Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Schedule the training(s) #22

Open
eyp opened this issue Dec 2, 2020 · 0 comments
Open

Schedule the training(s) #22

eyp opened this issue Dec 2, 2020 · 0 comments
Assignees
Labels
backend Related to the backend enhancement New feature or request server
Milestone

Comments

@eyp
Copy link
Owner

eyp commented Dec 2, 2020

Currently the training is launched with a button on the server's dashboard using the endpoint POST /training.

The training must be run every 30 minutes, 10 minutes or 1h: it must be a server's configuration param.

For running a schedule process we could simply add a cron job that calls the endpoint for training, or implement an internal solution in the server with APScheduler. Code example from Stackoverflow:

import time
import atexit

from apscheduler.schedulers.background import BackgroundScheduler


def print_date_time():
    print(time.strftime("%A, %d. %B %Y %I:%M:%S %p"))


scheduler = BackgroundScheduler()
scheduler.add_job(func=print_date_time, trigger="interval", seconds=3)
scheduler.start()

# Shut down the scheduler when exiting the app
atexit.register(lambda: scheduler.shutdown())

More info: https://stackoverflow.com/questions/21214270/how-to-schedule-a-function-to-run-every-hour-on-flask

@eyp eyp added enhancement New feature or request backend Related to the backend server labels Dec 2, 2020
@eyp eyp added this to the Version 1.0 milestone Dec 2, 2020
@eyp eyp self-assigned this Dec 2, 2020
@eyp eyp modified the milestones: Version 1.0, Version 1.1 Dec 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Related to the backend enhancement New feature or request server
Projects
None yet
Development

No branches or pull requests

1 participant