Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the deprecated logger.close #13149

3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).

### Removed

- Removed the deprecated `Logger.close` method ([#13149](https://github.com/PyTorchLightning/pytorch-lightning/pull/13149))


- Removed the deprecated `weights_summary` argument from the `Trainer` constructor ([#13070](https://github.com/PyTorchLightning/pytorch-lightning/pull/13070))


Expand Down
28 changes: 0 additions & 28 deletions pytorch_lightning/loggers/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,21 +177,6 @@ def finalize(self, status: str) -> None:
"""
self.save()

def close(self) -> None:
"""Do any cleanup that is necessary to close an experiment.

See deprecation warning below.

.. deprecated:: v1.5
This method is deprecated in v1.5 and will be removed in v1.7.
Please use `Logger.finalize` instead.
"""
rank_zero_deprecation(
"`Logger.close` method is deprecated in v1.5 and will be removed in v1.7."
" Please use `Logger.finalize` instead."
)
self.save()

@property
def save_dir(self) -> Optional[str]:
"""Return the root directory where experiment logs get saved, or `None` if the logger does not save data
Expand Down Expand Up @@ -285,19 +270,6 @@ def finalize(self, status: str) -> None:
for logger in self._logger_iterable:
logger.finalize(status)

def close(self) -> None:
"""
.. deprecated:: v1.5
This method is deprecated in v1.5 and will be removed in v1.7.
Please use `LoggerCollection.finalize` instead.
"""
rank_zero_deprecation(
"`LoggerCollection.close` method is deprecated in v1.5 and will be removed in v1.7."
" Please use `LoggerCollection.finalize` instead."
)
for logger in self._logger_iterable:
logger.close()

@property
def save_dir(self) -> Optional[str]:
"""Returns ``None`` as checkpoints should be saved to default / chosen location when using multiple
Expand Down
13 changes: 0 additions & 13 deletions tests/deprecated_api/test_remove_1-7.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

from pytorch_lightning import Callback, Trainer
from pytorch_lightning.callbacks.lr_monitor import LearningRateMonitor
from pytorch_lightning.loggers import LoggerCollection
from pytorch_lightning.overrides.distributed import IndexBatchSamplerWrapper
from pytorch_lightning.plugins.environments import (
KubeflowEnvironment,
Expand All @@ -34,7 +33,6 @@
from pytorch_lightning.strategies import SingleDeviceStrategy
from tests.deprecated_api import _soft_unimport_module
from tests.helpers import BoringModel
from tests.loggers.test_logger import CustomLogger
from tests.plugins.environments.test_lsf_environment import _make_rankfile


Expand Down Expand Up @@ -80,17 +78,6 @@ def test_v1_7_0_deprecate_add_get_queue(tmpdir):
trainer.fit(model)


def test_v1_7_0_lightning_logger_base_close(tmpdir):
logger = CustomLogger()
with pytest.deprecated_call(match="`Logger.close` method is deprecated in v1.5 and will be removed in v1.7."):
logger.close()
with pytest.deprecated_call(
match="`LoggerCollection.close` method is deprecated in v1.5 and will be removed in v1.7."
):
logger = LoggerCollection([logger])
logger.close()


def test_v1_7_0_deprecate_lightning_distributed(tmpdir):
with pytest.deprecated_call(match="LightningDistributed is deprecated in v1.5 and will be removed in v1.7."):
from pytorch_lightning.distributed.dist import LightningDistributed
Expand Down