简体   繁体   English

如何在特定时间间隔后自动运行我的 python model?

[英]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.

相关问题 在固定的时间间隔后,如何自动在django中执行特定任务? - How to perform a specific task in django automatically after a fixed interval of time? DBT运行(或特定模型)完成后如何运行python代码? - How can I run python code after a DBT run (or a specific model) is completed? 我如何在python中获取时间间隔 - How can i get the time interval in python 每次完成后,如何自动运行我的 python 脚本以再次运行? - How can I automate my python script to run again after every time it finished? 如何在Python中的特定时间运行某个函数? - How can I run a certain function for a specific time in Python? 如何让我的 Python 脚本在 2 小时后运行? - How can I make my Python script run after 2 hours? 如何在启动树莓派时在虚拟环境中自动同时运行 2 个 python 脚本? - How can I automatically run 2 python scripts at the same time in a virtual environment when booting up the Raspberry Pi? 如何为 python 中的数据设置日期间隔? - How can i set a date interval for my data in python? 在我的Django模型中,如何自动填充字段? - In my Django model, how can I automatically populate a field? 执行CGI Python脚本后,如何自动返回主页? - After a CGI Python script is executed, how can I return automatically to my homepage?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM