简体   繁体   中英

How can i run my python model automatically after specific time interval?

Hey everyone hope you all are fine.... I want to ask something from you, recently I build my model (Random Forest) in python machine learning and I got my predictions and make a web app in django that shows predicted values in front end. Now I want to deploy my web app and wants that after specific time interval my data become downloaded from api automatically, similar for data training file and data prediction file. Each task should run automatically after specific time interval because now each time I run program separately for data downloading, data training and doing prediction on data I want all these task should run automatically after specific time interval how I will achieve this task.... ?

Assuming the server is not on Docker or Windows, use django-crontab .

I would recommend setting up the data jobs as management commands, and then using the crontab to trigger them at the desired interval or time of day.

settings.py

CRONJOBS = [
    ('0   4 * * *', 'django.core.management.call_command', ['download_the_data']),
]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM