Skip to content

Commit acf659f

Browse files
committed
fix merge mistake
1 parent 12ba4c9 commit acf659f

File tree

4 files changed

+23
-30
lines changed

4 files changed

+23
-30
lines changed

cylc/flow/simulation.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
"""Utilities supporting simulation and skip modes
1717
"""
1818

19-
from queue import Queue
2019
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union
2120
from time import time
2221

@@ -33,6 +32,7 @@
3332
from metomi.isodatetime.parsers import DurationParser
3433

3534
if TYPE_CHECKING:
35+
from queue import Queue
3636
from cylc.flow.cycling import PointBase
3737
from cylc.flow.task_proxy import TaskProxy
3838

@@ -132,7 +132,7 @@ def disable_platforms(
132132

133133

134134
def parse_fail_cycle_points(
135-
f_pts_orig: list
135+
f_pts_orig: List[str]
136136
) -> 'Union[None, List[PointBase]]':
137137
"""Parse `[simulation][fail cycle points]`.
138138

cylc/flow/task_events_mgr.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -592,16 +592,6 @@ def process_message(
592592
itask, severity, message, event_time, flag, submit_num):
593593
return None
594594

595-
severity = cast(int, LOG_LEVELS.get(severity, INFO))
596-
# Demote log level to DEBUG if this is a message that duplicates what
597-
# gets logged by itask state change anyway (and not manual poll)
598-
if severity > DEBUG and flag != self.FLAG_POLLED and message in {
599-
self.EVENT_SUBMITTED, self.EVENT_STARTED, self.EVENT_SUCCEEDED,
600-
self.EVENT_SUBMIT_FAILED, f'{FAIL_MESSAGE_PREFIX}ERR'
601-
}:
602-
severity = DEBUG
603-
LOG.log(severity, f"[{itask}] {flag}{message} at {event_time}")
604-
605595
# always update the workflow state summary for latest message
606596
if flag == self.FLAG_POLLED:
607597
new_msg = f'{message} {self.FLAG_POLLED}'
@@ -819,6 +809,16 @@ def _process_message_check(
819809
f"{self.FLAG_POLLED_IGNORED}{message}{timestamp}"
820810
)
821811
return False
812+
813+
severity = cast('int', LOG_LEVELS.get(severity, INFO))
814+
# Demote log level to DEBUG if this is a message that duplicates what
815+
# gets logged by itask state change anyway (and not manual poll)
816+
if severity > DEBUG and flag != self.FLAG_POLLED and message in {
817+
self.EVENT_SUBMITTED, self.EVENT_STARTED, self.EVENT_SUCCEEDED,
818+
self.EVENT_SUBMIT_FAILED, f'{FAIL_MESSAGE_PREFIX}ERR'
819+
}:
820+
severity = DEBUG
821+
LOG.log(severity, f"[{itask}] {flag}{message}{timestamp}")
822822
return True
823823

824824
def setup_event_handlers(self, itask, event, message):

tests/unit/test_config.py

-1
Original file line numberDiff line numberDiff line change
@@ -1761,7 +1761,6 @@ def test_configure_sim_mode(caplog):
17611761
'outputs': {},
17621762
}
17631763
rtconfig_2 = deepcopy(rtconfig_1)
1764-
rtconfig_2['job'] = job_section
17651764
rtconfig_2['simulation']['default run length'] = 'PT2S'
17661765

17671766
taskdefs = [

tests/unit/test_simulation.py

+11-17
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,13 @@ def test_set_simulation_script(fail_one_time_only):
6767
}
6868
}
6969
result = build_dummy_script(rtc, 60)
70-
expect = [
70+
assert result.split('\n') == [
7171
'sleep 60',
7272
"cylc message '1'",
7373
"cylc message '2'",
7474
f"cylc__job__dummy_result {str(fail_one_time_only).lower()}"
7575
" 1 || exit 1"
7676
]
77-
for i, line in enumerate(result.split('\n')):
78-
assert expect[i] == line
7977

8078

8179
@pytest.mark.parametrize(
@@ -92,22 +90,18 @@ def test_disable_platforms(rtc, expect):
9290
disable_platforms(rtc)
9391
assert rtc['platform'] == expect
9492
subdicts = [v for v in rtc.values() if isinstance(v, dict)]
95-
for val in [
96-
v for subdict in subdicts
97-
for k, v in subdict.items()
98-
if k != 'platform'
99-
]:
100-
assert val is None
93+
for subdict in subdicts:
94+
for k, val in subdict.items():
95+
if k != 'platform':
96+
assert val is None
10197

10298

103-
def test_parse_fail_cycle_points(monkeypatch):
104-
before = ['2']
105-
monkeypatch.setattr(
106-
'cylc.flow.cycling.loader.get_point_cls',
107-
lambda cycling_type: IntegerPoint)
108-
result = parse_fail_cycle_points(before)[0]
109-
assert isinstance(result, IntegerPoint)
110-
assert int(result) == 2
99+
def test_parse_fail_cycle_points(set_cycling_type):
100+
before = ['2', '4']
101+
set_cycling_type()
102+
assert parse_fail_cycle_points(before) == [
103+
IntegerPoint(i) for i in before
104+
]
111105

112106

113107
@pytest.mark.parametrize(

0 commit comments

Comments
 (0)