@@ -433,7 +433,10 @@ def __init__(
433
433
self .process_start_cycle_point ()
434
434
self .process_final_cycle_point ()
435
435
self .process_stop_cycle_point ()
436
- self .start_point_checks ()
436
+ if self .start_point :
437
+ self .cycle_point_warning ('start' , 'before' , 'initial' )
438
+ self .cycle_point_warning ('start' , 'after' , 'final' )
439
+ self .cycle_point_warning ('stop' , 'before' , 'start' )
437
440
438
441
# Parse special task cycle point offsets, and replace family names.
439
442
LOG .debug ("Parsing [special tasks]" )
@@ -776,29 +779,24 @@ def process_start_cycle_point(self) -> None:
776
779
# Start from the initial point.
777
780
self .start_point = self .initial_point
778
781
779
- def start_point_checks (self ):
780
- """Check that the start point makes sense.
782
+ def cycle_point_warning (self , label1 , order , label2 ):
783
+ """Centralized logic for warning that start, stop, initial and
784
+ final cycle points are not sensibly ordered.
781
785
"""
782
- if not self .start_point :
783
- return
784
- elif self .start_point < self .initial_point :
785
- LOG .warning (
786
- f"Start cycle point '{ self .start_point } ' will have no "
787
- "effect as it is before the initial cycle "
788
- f"point '{ self .initial_point } '."
789
- )
790
- elif self .start_point > self .final_point :
791
- LOG .warning (
792
- f"Start cycle point '{ self .start_point } ' will have no "
793
- "effect as it is after the final cycle "
794
- f"point '{ self .final_point } '."
795
- )
796
- elif self .start_point > self .stop_point :
797
- LOG .warning (
798
- f"Stop cycle point '{ self .stop_point } ' will have no "
799
- "effect as it is before the start cycle "
800
- f"point '{ self .start_point } '."
786
+ point1 = getattr (self , label1 + '_point' )
787
+ point2 = getattr (self , label2 + '_point' )
788
+ if (
789
+ order == 'before' and point1 < point2
790
+ or order == 'after' and point1 > point2
791
+ ):
792
+ msg = (
793
+ f"{ label1 } cycle point '{ point1 } ' will have no effect as"
794
+ f" it is { order } the { label2 } cycle point '{ point2 } '."
801
795
)
796
+ # Capitalize() makes the ISO strings look very odd:
797
+ LOG .warning (msg [0 ].upper () + msg [1 :])
798
+ return True
799
+ return False
802
800
803
801
def process_final_cycle_point (self ) -> None :
804
802
"""Validate and set the final cycle point from flow.cylc or options.
@@ -880,25 +878,15 @@ def process_stop_cycle_point(self) -> None:
880
878
self .initial_point ,
881
879
).standardise ()
882
880
if (
883
- self .final_point is not None
884
- and self .stop_point is not None
885
- and self .stop_point > self .final_point
886
- ):
887
- LOG .warning (
888
- f"Stop cycle point '{ self .stop_point } ' will have no "
889
- "effect as it is after the final cycle "
890
- f"point '{ self .final_point } '."
881
+ self .stop_point is not None
882
+ and (
883
+ (
884
+ self .final_point is not None
885
+ and self .cycle_point_warning ('stop' , 'after' , 'final' )
886
+ )
887
+ or self .cycle_point_warning ('stop' , 'before' , 'initial' )
891
888
)
892
- self .stop_point = None
893
- if (
894
- self .stop_point is not None
895
- and self .stop_point < self .initial_point
896
889
):
897
- LOG .warning (
898
- f"Stop cycle point '{ self .stop_point } ' will have no "
899
- "effect as it is before the initial cycle "
900
- f"point '{ self .initial_point } '."
901
- )
902
890
self .stop_point = None
903
891
stopcp_str = str (self .stop_point ) if self .stop_point else None
904
892
self .cfg ['scheduling' ]['stop after cycle point' ] = stopcp_str
0 commit comments