[英]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. 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结尾。 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.
现在我想部署我的 web 应用程序,并希望在特定时间间隔后,我的数据会自动从 api 下载,类似于数据训练文件和数据预测文件。 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 .假设服务器不在 Docker 或 Windows 上,请使用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.我建议将数据作业设置为管理命令,然后使用 crontab 在所需的时间间隔或一天中的时间触发它们。
settings.py设置.py
CRONJOBS = [
('0 4 * * *', 'django.core.management.call_command', ['download_the_data']),
]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.