@@ -939,12 +939,9 @@ def rerun(
939939 "[WORKFLOW]: Does not rerun because it already executed with "
940940 "success status."
941941 )
942- return Result (
943- run_id = run_id ,
944- parent_run_id = parent_run_id ,
942+ return Result .from_trace (trace ).catch (
945943 status = SUCCESS ,
946944 context = catch (context = context , status = SUCCESS ),
947- extras = self .extras ,
948945 )
949946
950947 err : dict [str , str ] = context .get ("errors" , {})
@@ -960,12 +957,9 @@ def rerun(
960957 )
961958 if not self .jobs :
962959 trace .warning (f"[WORKFLOW]: { self .name !r} does not set jobs" )
963- return Result (
964- run_id = run_id ,
965- parent_run_id = parent_run_id ,
960+ return Result .from_trace (trace ).catch (
966961 status = SUCCESS ,
967962 context = catch (context = context , status = SUCCESS ),
968- extras = self .extras ,
969963 )
970964
971965 # NOTE: Prepare the new context variable for rerun process.
@@ -990,12 +984,9 @@ def rerun(
990984 "[WORKFLOW]: It does not have job to rerun. it will change "
991985 "status to skip."
992986 )
993- return Result (
994- run_id = run_id ,
995- parent_run_id = parent_run_id ,
987+ return Result .from_trace (trace ).catch (
996988 status = SKIP ,
997989 context = catch (context = context , status = SKIP ),
998- extras = self .extras ,
999990 )
1000991
1001992 not_timeout_flag : bool = True
@@ -1008,9 +999,7 @@ def rerun(
1008999
10091000 catch (context , status = WAIT )
10101001 if event and event .is_set ():
1011- return Result (
1012- run_id = run_id ,
1013- parent_run_id = parent_run_id ,
1002+ return Result .from_trace (trace ).catch (
10141003 status = CANCEL ,
10151004 context = catch (
10161005 context ,
@@ -1022,7 +1011,6 @@ def rerun(
10221011 ).to_dict (),
10231012 },
10241013 ),
1025- extras = self .extras ,
10261014 )
10271015
10281016 with ThreadPoolExecutor (max_job_parallel , "wf" ) as executor :
@@ -1050,9 +1038,7 @@ def rerun(
10501038 backoff_sleep = 0.01
10511039
10521040 if check == FAILED : # pragma: no cov
1053- return Result (
1054- run_id = run_id ,
1055- parent_run_id = parent_run_id ,
1041+ return Result .from_trace (trace ).catch (
10561042 status = FAILED ,
10571043 context = catch (
10581044 context ,
@@ -1065,7 +1051,6 @@ def rerun(
10651051 ).to_dict (),
10661052 },
10671053 ),
1068- extras = self .extras ,
10691054 )
10701055 elif check == SKIP : # pragma: no cov
10711056 trace .info (
@@ -1141,12 +1126,9 @@ def rerun(
11411126 statuses [total + 1 + skip_count + i ] = s
11421127
11431128 st : Status = validate_statuses (statuses )
1144- return Result (
1145- run_id = run_id ,
1146- parent_run_id = parent_run_id ,
1129+ return Result .from_trace (trace ).catch (
11471130 status = st ,
11481131 context = catch (context , status = st ),
1149- extras = self .extras ,
11501132 )
11511133
11521134 event .set ()
@@ -1160,9 +1142,7 @@ def rerun(
11601142
11611143 time .sleep (0.0025 )
11621144
1163- return Result (
1164- run_id = run_id ,
1165- parent_run_id = parent_run_id ,
1145+ return Result .from_trace (trace ).catch (
11661146 status = FAILED ,
11671147 context = catch (
11681148 context ,
@@ -1174,5 +1154,4 @@ def rerun(
11741154 ).to_dict (),
11751155 },
11761156 ),
1177- extras = self .extras ,
11781157 )
0 commit comments