|
47 | 47 | update_group_workflow_runtime_fields, |
48 | 48 | ) |
49 | 49 | from functions_settings import get_settings, is_group_workflows_enabled_for_group, update_settings |
50 | | -from functions_workflow_runner import run_group_workflow, run_personal_workflow |
| 50 | +from functions_workflow_runner import create_workflow_run_id, run_group_workflow, run_personal_workflow |
51 | 51 |
|
52 | 52 |
|
53 | 53 | def _get_lock_holder_id(): |
@@ -514,18 +514,26 @@ def check_due_workflows_once(): |
514 | 514 | pass |
515 | 515 |
|
516 | 516 | started_at = datetime.now(timezone.utc).isoformat() |
| 517 | + active_run_id = create_workflow_run_id() |
517 | 518 | update_personal_workflow_runtime_fields( |
518 | 519 | user_id, |
519 | 520 | workflow_id, |
520 | 521 | { |
521 | 522 | 'status': 'running', |
| 523 | + 'active_run_id': active_run_id, |
| 524 | + 'cancellation_requested_at': None, |
| 525 | + 'cancellation_requested_by': '', |
522 | 526 | 'last_run_started_at': started_at, |
523 | 527 | 'last_run_trigger_source': trigger_source, |
524 | 528 | 'last_run_error': '', |
525 | 529 | }, |
526 | 530 | ) |
527 | 531 |
|
528 | | - result = run_personal_workflow(refreshed_workflow, trigger_source=trigger_source) |
| 532 | + result = run_personal_workflow( |
| 533 | + refreshed_workflow, |
| 534 | + trigger_source=trigger_source, |
| 535 | + run_id=active_run_id, |
| 536 | + ) |
529 | 537 | update_fields = dict(result.get('workflow_updates') or {}) |
530 | 538 | update_fields['status'] = 'idle' |
531 | 539 | update_fields['next_run_at'] = compute_next_run_at(refreshed_workflow, from_time=datetime.now(timezone.utc)) |
@@ -590,18 +598,26 @@ def check_due_workflows_once(): |
590 | 598 | pass |
591 | 599 |
|
592 | 600 | started_at = datetime.now(timezone.utc).isoformat() |
| 601 | + active_run_id = create_workflow_run_id() |
593 | 602 | update_group_workflow_runtime_fields( |
594 | 603 | group_id, |
595 | 604 | workflow_id, |
596 | 605 | { |
597 | 606 | 'status': 'running', |
| 607 | + 'active_run_id': active_run_id, |
| 608 | + 'cancellation_requested_at': None, |
| 609 | + 'cancellation_requested_by': '', |
598 | 610 | 'last_run_started_at': started_at, |
599 | 611 | 'last_run_trigger_source': trigger_source, |
600 | 612 | 'last_run_error': '', |
601 | 613 | }, |
602 | 614 | ) |
603 | 615 |
|
604 | | - result = run_group_workflow(refreshed_workflow, trigger_source=trigger_source) |
| 616 | + result = run_group_workflow( |
| 617 | + refreshed_workflow, |
| 618 | + trigger_source=trigger_source, |
| 619 | + run_id=active_run_id, |
| 620 | + ) |
605 | 621 | update_fields = dict(result.get('workflow_updates') or {}) |
606 | 622 | update_fields['status'] = 'idle' |
607 | 623 | update_fields['next_run_at'] = compute_next_run_at(refreshed_workflow, from_time=datetime.now(timezone.utc)) |
|
0 commit comments