Coverage for django_napse/core/tasks/controller_update.py: 61%

18 statements  

« prev     ^ index     » next       coverage.py v7.4.3, created at 2024-03-12 13:49 +0000

1from django_napse.core.models import Controller 

2from django_napse.core.tasks.base_tasks import BaseTask 

3 

4 

5class ControllerUpdateTask(BaseTask): 

6 name = "controller_update" 

7 interval_time = 45 

8 time_limit = 60 

9 soft_time_limit = 60 

10 

11 def run(self): 

12 """Run a task to update all controllers.""" 

13 print("ControllerUpdateTask") 

14 if not self.avoid_overlap(verbose=True): 

15 print("skipped") 

16 return 

17 for controller in Controller.objects.all(): 

18 controller._update_variables() 

19 controller._get_price() 

20 

21 

22ControllerUpdateTask().delete_task() 

23ControllerUpdateTask().register_task() 

24 

25print("ControllerUpdateTask registered")