(sender, task_id, **kwargs)
| 11 | |
| 12 | @receiver(task_completed) |
| 13 | def handle_task_completed(sender, task_id, **kwargs): |
| 14 | if get_current_plugin(only_active=True) is None: |
| 15 | return |
| 16 | |
| 17 | logger.info("TaskNotification: Task Completed") |
| 18 | |
| 19 | config_data = config.load() |
| 20 | if config_data.get("notify_task_completed") == True: |
| 21 | task = Task.objects.get(id=task_id) |
| 22 | setting = Setting.objects.first() |
| 23 | notification_app_name = config_data['notification_app_name'] or settings.app_name |
| 24 | |
| 25 | console_output = reverse_output(task.console.output()) |
| 26 | notification.send( |
| 27 | f"{notification_app_name} - {task.project.name} Task Completed", |
| 28 | f"{task.project.name}\n{task.name} Completed\nProcessing time:{hours_minutes_secs(task.processing_time)}\n\nConsole Output:{console_output}", |
| 29 | config_data |
| 30 | ) |
| 31 | |
| 32 | @receiver(task_removed) |
| 33 | def handle_task_removed(sender, task_id, **kwargs): |
nothing calls this directly
no test coverage detected