@@ -548,7 +548,7 @@ def _get_remote_conf(self, itask, key):
548
548
itask .platform [key ]
549
549
)
550
550
551
- def _get_workflow_platforms_conf (self , itask , key ):
551
+ def _get_workflow_platforms_conf (self , itask : 'TaskProxy' , key : str ):
552
552
"""Return top level [runtime] items that default to platforms."""
553
553
overrides = self .broadcast_mgr .get_broadcast (itask .tokens )
554
554
return (
@@ -1844,7 +1844,7 @@ def _get_handler_template_variables(
1844
1844
}
1845
1845
# fmt: on
1846
1846
1847
- def _reset_job_timers (self , itask ):
1847
+ def _reset_job_timers (self , itask : 'TaskProxy' ):
1848
1848
"""Set up poll timer and timeout for task."""
1849
1849
1850
1850
if itask .transient :
@@ -1898,18 +1898,18 @@ def _reset_job_timers(self, itask):
1898
1898
itask .poll_timer = TaskActionTimer (ctx = ctx , delays = delays )
1899
1899
# Log timeout and polling schedule
1900
1900
message = f"health: { timeout_key } ={ timeout_str } "
1901
- # Attempt to group identical consecutive delays as N*DELAY,...
1902
1901
if itask .poll_timer .delays :
1903
- items = [] # [(number of item - 1, item), ...]
1902
+ # Group identical consecutive delays as N*DELAY,...
1903
+ items : List [List [float ]] = [] # [[number of item, item], ...]
1904
1904
for delay in itask .poll_timer .delays :
1905
1905
if items and items [- 1 ][1 ] == delay :
1906
1906
items [- 1 ][0 ] += 1
1907
1907
else :
1908
- items .append ([0 , delay ])
1908
+ items .append ([1 , delay ])
1909
1909
message += ', polling intervals='
1910
1910
for num , item in items :
1911
- if num :
1912
- message += '%d*' % ( num + 1 )
1911
+ if num > 1 :
1912
+ message += f' { num } *'
1913
1913
message += '%s,' % intvl_as_str (item )
1914
1914
message += '...'
1915
1915
LOG .debug (f"[{ itask } ] { message } " )
@@ -1920,7 +1920,7 @@ def _reset_job_timers(self, itask):
1920
1920
def process_execution_polling_intervals (
1921
1921
polling_intervals : List [float ],
1922
1922
time_limit : float ,
1923
- time_limit_polling_intervals : List [float ]
1923
+ time_limit_polling_intervals : Optional [ List [float ] ]
1924
1924
) -> List [float ]:
1925
1925
"""Create a list of polling times.
1926
1926
@@ -1952,6 +1952,11 @@ def process_execution_polling_intervals(
1952
1952
>>> this([], 10, [5])
1953
1953
[15, 5]
1954
1954
1955
+ # There are no execution time limit polling intervals set - just
1956
+ # repeat the execution polling interval until the time limit:
1957
+ >>> this([10], 25, None)
1958
+ [10, 10]
1959
+
1955
1960
# We have a list of execution time limit polling intervals,
1956
1961
>>> this([10], 25, [5, 6, 7, 8])
1957
1962
[10, 10, 10, 6, 7, 8]
@@ -1968,17 +1973,19 @@ def process_execution_polling_intervals(
1968
1973
size = int ((time_limit - sum (delays )) / delays [- 1 ])
1969
1974
delays .extend ([delays [- 1 ]] * size )
1970
1975
1971
- # After the last delay before the execution time limit add the
1972
- # delay to get to the execution_time_limit
1973
- if len (time_limit_polling_intervals ) == 1 :
1974
- time_limit_polling_intervals .append (
1975
- time_limit_polling_intervals [0 ]
1976
- )
1977
- time_limit_polling_intervals [0 ] += time_limit - sum (delays )
1976
+ if time_limit_polling_intervals :
1977
+ # After the last delay before the execution time limit add the
1978
+ # delay to get to the execution_time_limit
1979
+ if len (time_limit_polling_intervals ) == 1 :
1980
+ time_limit_polling_intervals .append (
1981
+ time_limit_polling_intervals [0 ]
1982
+ )
1983
+ time_limit_polling_intervals [0 ] += time_limit - sum (delays )
1984
+
1985
+ # After the execution time limit, poll at the
1986
+ # execution time limit polling intervals.
1987
+ delays += time_limit_polling_intervals
1978
1988
1979
- # After the execution time limit poll at execution time limit polling
1980
- # intervals.
1981
- delays += time_limit_polling_intervals
1982
1989
return delays
1983
1990
1984
1991
def add_event_timer (self , id_key : EventKey , event_timer ) -> None :
0 commit comments