|
19 | 19 | Constants: |
20 | 20 | NORMAL: Normal release execution |
21 | 21 | RERUN: Re-execution of failed workflows |
22 | | - EVENT: Event-triggered execution |
| 22 | + DRYRUN: Dryrun execution for testing workflow loop. |
23 | 23 | FORCE: Force execution regardless of conditions |
24 | 24 | """ |
25 | 25 | import copy |
26 | 26 | import time |
| 27 | +import traceback |
27 | 28 | from concurrent.futures import ( |
28 | 29 | Future, |
29 | 30 | ThreadPoolExecutor, |
|
50 | 51 | WorkflowError, |
51 | 52 | WorkflowSkipError, |
52 | 53 | WorkflowTimeoutError, |
| 54 | + to_dict, |
53 | 55 | ) |
54 | 56 | from .event import Event |
55 | 57 | from .job import Job |
@@ -667,22 +669,9 @@ def process( |
667 | 669 |
|
668 | 670 | if check == FAILED: # pragma: no cov |
669 | 671 | pop_sys_extras(self.extras) |
670 | | - return Result( |
671 | | - run_id=run_id, |
672 | | - parent_run_id=parent_run_id, |
673 | | - status=FAILED, |
674 | | - context=catch( |
675 | | - context, |
676 | | - status=FAILED, |
677 | | - updated={ |
678 | | - "status": FAILED, |
679 | | - "errors": WorkflowError( |
680 | | - f"Validate job trigger rule was failed " |
681 | | - f"with {job.trigger_rule.value!r}." |
682 | | - ).to_dict(), |
683 | | - }, |
684 | | - ), |
685 | | - extras=self.extras, |
| 672 | + raise WorkflowError( |
| 673 | + f"Validate job trigger rule was failed with " |
| 674 | + f"{job.trigger_rule.value!r}." |
686 | 675 | ) |
687 | 676 | elif check == SKIP: # pragma: no cov |
688 | 677 | trace.info( |
@@ -1026,12 +1015,23 @@ def execute( |
1026 | 1015 | trace.error(f"⏭️ Skip: {e}", module="workflow") |
1027 | 1016 | updated = None |
1028 | 1017 | else: |
1029 | | - trace.error(f"📢 Workflow Failed: {e}", module="workflow") |
| 1018 | + trace.error(f"📢 Workflow Failed:||{e}", module="workflow") |
1030 | 1019 |
|
1031 | 1020 | st: Status = get_status_from_error(e) |
1032 | 1021 | return Result.from_trace(trace).catch( |
1033 | 1022 | status=st, context=catch(context, status=st, updated=updated) |
1034 | 1023 | ) |
| 1024 | + except Exception as e: |
| 1025 | + trace.error( |
| 1026 | + f"💥 Error Failed:||🚨 {traceback.format_exc()}||", |
| 1027 | + module="workflow", |
| 1028 | + ) |
| 1029 | + return Result.from_trace(trace).catch( |
| 1030 | + status=FAILED, |
| 1031 | + context=catch( |
| 1032 | + context, status=FAILED, updated={"errors": to_dict(e)} |
| 1033 | + ), |
| 1034 | + ) |
1035 | 1035 | finally: |
1036 | 1036 | context["info"].update( |
1037 | 1037 | { |
|
0 commit comments