Skip to content

Commit e2980de

Browse files
committed
Make the internal attribute skip_completed_after_termination private
1 parent a27632f commit e2980de

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

Diff for: ignite/engine/engine.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def __init__(self, process_function: Callable[["Engine", Any], Any]):
140140
self._process_function = process_function
141141
self.last_event_name: Optional[Events] = None
142142
self.should_terminate = False
143-
self.skip_completed_after_termination = False
143+
self._skip_completed_after_termination = False
144144
self.should_terminate_single_epoch = False
145145
self._skip_epoch_completed_after_termination = False
146146
self.should_interrupt = False
@@ -627,7 +627,7 @@ def terminate():
627627
"""
628628
self.logger.info("Terminate signaled. Engine will stop after current iteration is finished.")
629629
self.should_terminate = True
630-
self.skip_completed_after_termination = skip_completed
630+
self._skip_completed_after_termination = skip_completed
631631

632632
def terminate_epoch(self, skip_epoch_completed: bool = False) -> None:
633633
"""Sends terminate signal to the engine, so that it terminates the current epoch. The run
@@ -1015,7 +1015,7 @@ def _internal_run_as_gen(self) -> Generator[Any, None, State]:
10151015
self.state.times[Events.COMPLETED.name] = time_taken
10161016

10171017
# do not fire Events.COMPLETED if we terminated the run with flag `skip_completed=True`
1018-
if not (self.should_terminate and self.skip_completed_after_termination):
1018+
if not (self.should_terminate and self._skip_completed_after_termination):
10191019
handlers_start_time = time.time()
10201020
self._fire_event(Events.COMPLETED)
10211021
time_taken += time.time() - handlers_start_time
@@ -1204,7 +1204,7 @@ def _internal_run_legacy(self) -> State:
12041204
self.state.times[Events.COMPLETED.name] = time_taken
12051205

12061206
# do not fire Events.COMPLETED if we terminated the run with flag `skip_completed=True`
1207-
if not (self.should_terminate and self.skip_completed_after_termination):
1207+
if not (self.should_terminate and self._skip_completed_after_termination):
12081208
handlers_start_time = time.time()
12091209
self._fire_event(Events.COMPLETED)
12101210
time_taken += time.time() - handlers_start_time

Diff for: tests/ignite/engine/test_engine.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ def set_interrupt_resume_enabled(self, interrupt_resume_enabled):
4444
def test_terminate(self, skip_completed):
4545
engine = Engine(lambda e, b: 1)
4646
assert not engine.should_terminate
47-
assert not engine.skip_completed_after_termination
47+
assert not engine._skip_completed_after_termination
4848
engine.terminate(skip_completed)
4949
assert engine.should_terminate
50-
assert engine.skip_completed_after_termination == skip_completed
50+
assert engine._skip_completed_after_termination == skip_completed
5151

5252
def test_invalid_process_raises_with_invalid_signature(self):
5353
with pytest.raises(ValueError, match=r"Engine must be given a processing function in order to run"):

0 commit comments

Comments
 (0)