Skip to content

Commit

Permalink
Clarify work.stop() limitation (#16073)
Browse files Browse the repository at this point in the history
  • Loading branch information
carmocca committed Dec 19, 2022
1 parent 2a85d9b commit 0abd686
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/lightning_app/core/work.py
Original file line number Diff line number Diff line change
Expand Up @@ -630,12 +630,12 @@ def on_exit(self):
pass

def stop(self):
"""Stops LightingWork component and shuts down hardware provisioned via L.CloudCompute."""
"""Stops LightingWork component and shuts down hardware provisioned via L.CloudCompute.
This can only be called from a ``LightningFlow``.
"""
if not self._backend:
raise Exception(
"Can't stop the work, it looks like it isn't attached to a LightningFlow. "
"Make sure to assign the Work to a flow instance."
)
raise RuntimeError(f"Only the `LightningFlow` can request this work ({self.name!r}) to stop.")
if self.status.stage == WorkStageStatus.STOPPED:
return
latest_hash = self._calls[CacheCallsKeys.LATEST_CALL_HASH]
Expand Down

0 comments on commit 0abd686

Please sign in to comment.