Skip to content

Commit c16dcb7

Browse files
ishtoscarmocca
andauthored
Remove the deprecated logger.close (Lightning-AI#13149)
* refactor:removed the close instance from the LoggerCollection class * Also logger.close() * Update CHANGELOG Co-authored-by: Carlos Mocholí <[email protected]>
1 parent 2876ab0 commit c16dcb7

File tree

3 files changed

+3
-41
lines changed

3 files changed

+3
-41
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
123123

124124
### Removed
125125

126+
- Removed the deprecated `Logger.close` method ([#13149](https://github.com/PyTorchLightning/pytorch-lightning/pull/13149))
127+
128+
126129
- Removed the deprecated `weights_summary` argument from the `Trainer` constructor ([#13070](https://github.com/PyTorchLightning/pytorch-lightning/pull/13070))
127130

128131

pytorch_lightning/loggers/logger.py

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -177,21 +177,6 @@ def finalize(self, status: str) -> None:
177177
"""
178178
self.save()
179179

180-
def close(self) -> None:
181-
"""Do any cleanup that is necessary to close an experiment.
182-
183-
See deprecation warning below.
184-
185-
.. deprecated:: v1.5
186-
This method is deprecated in v1.5 and will be removed in v1.7.
187-
Please use `Logger.finalize` instead.
188-
"""
189-
rank_zero_deprecation(
190-
"`Logger.close` method is deprecated in v1.5 and will be removed in v1.7."
191-
" Please use `Logger.finalize` instead."
192-
)
193-
self.save()
194-
195180
@property
196181
def save_dir(self) -> Optional[str]:
197182
"""Return the root directory where experiment logs get saved, or `None` if the logger does not save data
@@ -285,19 +270,6 @@ def finalize(self, status: str) -> None:
285270
for logger in self._logger_iterable:
286271
logger.finalize(status)
287272

288-
def close(self) -> None:
289-
"""
290-
.. deprecated:: v1.5
291-
This method is deprecated in v1.5 and will be removed in v1.7.
292-
Please use `LoggerCollection.finalize` instead.
293-
"""
294-
rank_zero_deprecation(
295-
"`LoggerCollection.close` method is deprecated in v1.5 and will be removed in v1.7."
296-
" Please use `LoggerCollection.finalize` instead."
297-
)
298-
for logger in self._logger_iterable:
299-
logger.close()
300-
301273
@property
302274
def save_dir(self) -> Optional[str]:
303275
"""Returns ``None`` as checkpoints should be saved to default / chosen location when using multiple

tests/deprecated_api/test_remove_1-7.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222

2323
from pytorch_lightning import Callback, Trainer
2424
from pytorch_lightning.callbacks.lr_monitor import LearningRateMonitor
25-
from pytorch_lightning.loggers import LoggerCollection
2625
from pytorch_lightning.overrides.distributed import IndexBatchSamplerWrapper
2726
from pytorch_lightning.plugins.environments import (
2827
KubeflowEnvironment,
@@ -34,7 +33,6 @@
3433
from pytorch_lightning.strategies import SingleDeviceStrategy
3534
from tests.deprecated_api import _soft_unimport_module
3635
from tests.helpers import BoringModel
37-
from tests.loggers.test_logger import CustomLogger
3836
from tests.plugins.environments.test_lsf_environment import _make_rankfile
3937

4038

@@ -80,17 +78,6 @@ def test_v1_7_0_deprecate_add_get_queue(tmpdir):
8078
trainer.fit(model)
8179

8280

83-
def test_v1_7_0_lightning_logger_base_close(tmpdir):
84-
logger = CustomLogger()
85-
with pytest.deprecated_call(match="`Logger.close` method is deprecated in v1.5 and will be removed in v1.7."):
86-
logger.close()
87-
with pytest.deprecated_call(
88-
match="`LoggerCollection.close` method is deprecated in v1.5 and will be removed in v1.7."
89-
):
90-
logger = LoggerCollection([logger])
91-
logger.close()
92-
93-
9481
def test_v1_7_0_deprecate_lightning_distributed(tmpdir):
9582
with pytest.deprecated_call(match="LightningDistributed is deprecated in v1.5 and will be removed in v1.7."):
9683
from pytorch_lightning.distributed.dist import LightningDistributed

0 commit comments

Comments
 (0)