@@ -117,9 +117,9 @@ async def start_operation(
117117
118118 async def cancel_operation (self , schedule_id : ScheduleId ) -> None :
119119 """
120- Sets the operation to revert form the point in which it arrived in:
121- - when is_creating=True: cancels all steps & moves operation to revert
122- - when is_creating=False: does nothing, since revert is already running
120+ Sets the operation to undo form the point in which it arrived in:
121+ - when is_creating=True: cancels all steps & moves operation to undo
122+ - when is_creating=False: does nothing, since undo is already running
123123
124124 # NOTE: SEE `_on_schedule_event` for more details
125125 """
@@ -131,7 +131,7 @@ async def cancel_operation(self, schedule_id: ScheduleId) -> None:
131131
132132 if is_creating is False :
133133 _logger .warning (
134- "Cannot cancel steps for schedule_id='%s' since REVERT is running" ,
134+ "Cannot cancel steps for schedule_id='%s' since UNDO is running" ,
135135 schedule_id ,
136136 )
137137 return
@@ -270,7 +270,7 @@ async def restart_operation_step_stuck_in_error(
270270 step_name ,
271271 operation_name ,
272272 schedule_id ,
273- "manual intervention" if in_manual_intervention else "error in revert " ,
273+ "manual intervention" if in_manual_intervention else "error in undo " ,
274274 )
275275 # restart only this step
276276 await start_and_mark_as_started (
@@ -303,24 +303,24 @@ async def _on_schedule_event(self, schedule_id: ScheduleId) -> None:
303303 - `CEREATEING`: default mode when starting an operation
304304 - runs the `create()` of each step in each group (`first` -> `last` group)
305305 - when done, it removes all operation data
306- - `REVERTING `: revert the actions of `create()` in reverse order with respect to CREATING
307- - runs the `revert ()` of each step in each group (`current` -> `first` group)
306+ - `UNDOING `: undo the actions of `create()` in reverse order with respect to CREATING
307+ - runs the `undo ()` of each step in each group (`current` -> `first` group)
308308 - when done, it removes all operation data
309309 - `REPEATING`: repeats the `create()` of all steps in a group
310310 - waits and runs the `create()` of all the steps in last group in the operation
311311 - never completes, unless operation is cancelled
312312
313313 NOTE: `REPEATING` is triggered by setting `BaseStepGroup(repeat_steps=True)` during definition
314314 of an `operation`.
315- NOTE: `REVERTING ` is triggered by calling `cancel_operation()` or when a step finishes with
315+ NOTE: `UNDOING ` is triggered by calling `cancel_operation()` or when a step finishes with
316316 status `FAILED` or `CANCELLED` (except in manual intervention).
317317
318318 There are 3 reasons why an operation will hang:
319319 - MANUAL_INTERVENTION: step failed during `create()` and flagged for manual intervention
320320 -> requires support intervention
321- - STEP_ISSUE: a step failed during `revert ()` due to an error in the step's revert code
321+ - STEP_ISSUE: a step failed during `undo ()` due to an error in the step's undo code
322322 -> unexpected behviour / requires developer intervention
323- - FRAMEWORK_ISSUE: a step failed during `revert ()` because it was cancelled
323+ - FRAMEWORK_ISSUE: a step failed during `undo ()` because it was cancelled
324324 -> unexpected behviour / requires developer intervention
325325
326326 NOTE: only MANUAL_INTERVENTION is an allowed to happen all other failuires are to be treated
@@ -398,8 +398,8 @@ async def _on_schedule_event(self, schedule_id: ScheduleId) -> None:
398398 )
399399
400400 else :
401- with log_context (_logger , logging .DEBUG , f"REVERTING { base_message } " ):
402- await self ._advance_as_reverting (
401+ with log_context (_logger , logging .DEBUG , f"UNDOING { base_message } " ):
402+ await self ._advance_as_undoing (
403403 steps_statuses ,
404404 schedule_data_proxy ,
405405 schedule_id ,
@@ -419,15 +419,15 @@ async def _advance_as_repeating(
419419 ) -> None :
420420 # REPEATING logic:
421421 # 1) sleep before repeating
422- # 2) if any of the repeating steps was cancelled -> move to revert
422+ # 2) if any of the repeating steps was cancelled -> move to undo
423423 # 3) -> restart all steps in the group
424424
425425 step_proxies : Iterable [StepStoreProxy ] = group_step_proxies .values ()
426426
427427 # 1) sleep before repeating
428428 await asyncio .sleep (current_step_group .wait_before_repeat .total_seconds ())
429429
430- # 2) if any of the repeating steps was cancelled -> move to revert
430+ # 2) if any of the repeating steps was cancelled -> move to undo
431431
432432 # since some time passed, query all steps statuses again,
433433 # a cancellation request might have been requested
@@ -467,7 +467,7 @@ async def _advance_as_creating(
467467 # - 1a) -> move to next group
468468 # - 1b) if reached the end of the CREATE operation -> remove all created data
469469 # 2) if manual intervention is required -> do nothing else
470- # 3) if any step in CANCELLED or FAILED (and not in manual intervention) -> move to revert
470+ # 3) if any step in CANCELLED or FAILED (and not in manual intervention) -> move to undo
471471
472472 # 1) if all steps in group in SUUCESS
473473 if all (status == StepStatus .SUCCESS for status in steps_statuses .values ()):
@@ -522,15 +522,15 @@ async def _advance_as_creating(
522522 )
523523 return
524524
525- # 3) if any step in CANCELLED or FAILED (and not in manual intervention) -> move to revert
525+ # 3) if any step in CANCELLED or FAILED (and not in manual intervention) -> move to undo
526526 if any (
527527 s in {StepStatus .FAILED , StepStatus .CANCELLED }
528528 for s in steps_statuses .values ()
529529 ):
530530 with log_context (
531531 _logger ,
532532 logging .DEBUG ,
533- f"{ operation_name = } was not successfull: { steps_statuses = } , moving to revert " ,
533+ f"{ operation_name = } was not successfull: { steps_statuses = } , moving to undo " ,
534534 ):
535535 await schedule_data_proxy .create_or_update ("is_creating" , value = False )
536536 await enqueue_schedule_event (self .app , schedule_id )
@@ -540,7 +540,7 @@ async def _advance_as_creating(
540540 direction = "creation" , steps_statuses = steps_statuses , schedule_id = schedule_id
541541 )
542542
543- async def _advance_as_reverting (
543+ async def _advance_as_undoing (
544544 self ,
545545 steps_statuses : dict [StepName , StepStatus ],
546546 schedule_data_proxy : ScheduleDataStoreProxy ,
@@ -549,9 +549,9 @@ async def _advance_as_reverting(
549549 group_index : NonNegativeInt ,
550550 current_step_group : BaseStepGroup ,
551551 ) -> None :
552- # REVERT logic:
552+ # UNDO logic:
553553 # 1) if all steps in group in SUCCESS
554- # - 1a) if reached the end of the REVERT operation -> remove all created data
554+ # - 1a) if reached the end of the UNDO operation -> remove all created data
555555 # - 1b) -> move to previous group
556556 # 2) it is unexpected to have a FAILED step -> do nothing else
557557 # 3) it is unexpected to have a CANCELLED step -> do nothing else
@@ -561,7 +561,7 @@ async def _advance_as_reverting(
561561 previous_group_index = group_index - 1
562562 if previous_group_index < 0 :
563563
564- # 1a) if reached the end of the REVERT operation -> remove all created data
564+ # 1a) if reached the end of the UNDO operation -> remove all created data
565565 await cleanup_after_finishing (
566566 self ._store , schedule_id = schedule_id , is_creating = False
567567 )
@@ -598,7 +598,7 @@ async def _advance_as_reverting(
598598 for step_name , traceback in error_tracebacks
599599 )
600600 message = (
601- f"Operation 'revert ' for schedule_id='{ schedule_id } ' failed for steps: "
601+ f"Operation 'undo ' for schedule_id='{ schedule_id } ' failed for steps: "
602602 f"'{ failed_step_names } '. Step code should never fail during destruction, "
603603 f"please report to developers:\n { formatted_tracebacks } "
604604 )
@@ -613,7 +613,7 @@ async def _advance_as_reverting(
613613 n for n , s in steps_statuses .items () if s == StepStatus .CANCELLED
614614 ]:
615615 message = (
616- f"Operation 'revert ' for schedule_id='{ schedule_id } ' was cancelled for steps: "
616+ f"Operation 'undo ' for schedule_id='{ schedule_id } ' was cancelled for steps: "
617617 f"{ cancelled_step_names } . This should not happen, and should be addressed."
618618 )
619619 _logger .error (message )
@@ -626,7 +626,7 @@ async def _advance_as_reverting(
626626 return
627627
628628 raise UnexpectedStepHandlingError (
629- direction = "revert " , steps_statuses = steps_statuses , schedule_id = schedule_id
629+ direction = "undo " , steps_statuses = steps_statuses , schedule_id = schedule_id
630630 )
631631
632632
@@ -642,10 +642,10 @@ async def start_operation(
642642
643643async def cancel_operation (app : FastAPI , schedule_id : ScheduleId ) -> None :
644644 """
645- Unstruct scheduler to revert all steps completed until
645+ Unstruct scheduler to undo all steps completed until
646646 now for the running operation.
647647
648- `reverting ` refers to the act of undoing the effects of a step
648+ `undoing ` refers to the act of undoing the effects of a step
649649 that has already been completed (eg: remove a created network)
650650 """
651651 await Core .get_from_app_state (app ).cancel_operation (schedule_id )
@@ -667,14 +667,14 @@ async def restart_operation_step_stuck_in_manual_intervention_during_create(
667667 )
668668
669669
670- async def restart_operation_step_stuck_during_revert (
670+ async def restart_operation_step_stuck_during_undo (
671671 app : FastAPI , schedule_id : ScheduleId , step_name : StepName
672672) -> None :
673673 """
674- Restarts a `stuck step` while the operation is being reverted
674+ Restarts a `stuck step` while the operation is being undone
675675
676676 `stuck step` is a step that has failed and exhausted all retries
677- `reverting ` refers to the act of undoing the effects of a step
677+ `undoing ` refers to the act of undoing the effects of a step
678678 that has already been completed (eg: remove a created network)
679679 """
680680 await Core .get_from_app_state (app ).restart_operation_step_stuck_in_error (
0 commit comments