Skip to content

Commit

Permalink
Remove deprecated Trainer.slurm_job_id (#13459)
Browse files Browse the repository at this point in the history
  • Loading branch information
awaelchli authored Jul 13, 2022
1 parent 732a541 commit 07e7d6d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 12 deletions.
3 changes: 3 additions & 0 deletions src/pytorch_lightning/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Removed deprecated `pytorch_lightning.callbacks.lr_monitor.LearningRateMonitor.lr_sch_names` ([#13353](https://github.com/Lightning-AI/lightning/pull/13353))


- Removed deprecated `Trainer.slurm_job_id` in favor of `SLURMEnvironment.job_id` ([#13459](https://github.com/PyTorchLightning/pytorch-lightning/pull/13459))


- Removed support for the `DDP2Strategy` ([#12705](https://github.com/PyTorchLightning/pytorch-lightning/pull/12705))


Expand Down
6 changes: 0 additions & 6 deletions src/pytorch_lightning/trainer/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
PLUGIN_INPUT,
PrecisionPlugin,
)
from pytorch_lightning.plugins.environments.slurm_environment import SLURMEnvironment
from pytorch_lightning.profilers import (
AdvancedProfiler,
PassThroughProfiler,
Expand Down Expand Up @@ -2230,11 +2229,6 @@ def use_amp(self) -> bool:
def is_global_zero(self) -> bool:
return self.strategy.is_global_zero

@property
def slurm_job_id(self) -> Optional[int]:
rank_zero_deprecation("Method `slurm_job_id` is deprecated in v1.6.0 and will be removed in v1.7.0.")
return SLURMEnvironment.job_id()

@property
def distributed_sampler_kwargs(self) -> Optional[dict]:
if isinstance(self.strategy, ParallelStrategy):
Expand Down
6 changes: 0 additions & 6 deletions tests/tests_pytorch/deprecated_api/test_remove_1-7.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,6 @@ def on_post_move_to_device(self):
trainer.fit(model)


def test_v1_7_0_deprecated_slurm_job_id():
trainer = Trainer()
with pytest.deprecated_call(match="Method `slurm_job_id` is deprecated in v1.6.0 and will be removed in v1.7.0."):
trainer.slurm_job_id


def test_v1_7_0_deprecated_max_steps_none(tmpdir):
with pytest.deprecated_call(match="`max_steps = None` is deprecated in v1.5"):
_ = Trainer(max_steps=None)
Expand Down

0 comments on commit 07e7d6d

Please sign in to comment.