diff --git a/.gitignore b/.gitignore index 982309a8a3..03c30bc8ca 100644 --- a/.gitignore +++ b/.gitignore @@ -110,8 +110,8 @@ celerybeat-schedule # dotenv .env -.env_staging -.env_local +.env.staging +.env.local # virtualenv .venv diff --git a/src/lightning_app/core/work.py b/src/lightning_app/core/work.py index 43ffc0006d..3bb2e209d7 100644 --- a/src/lightning_app/core/work.py +++ b/src/lightning_app/core/work.py @@ -124,7 +124,16 @@ class LightningWork: " in the next version. Use `cache_calls` instead." ) self._cache_calls = run_once if run_once is not None else cache_calls - self._state = {"_host", "_port", "_url", "_future_url", "_internal_ip", "_restarting", "_cloud_compute"} + self._state = { + "_host", + "_port", + "_url", + "_future_url", + "_internal_ip", + "_restarting", + "_cloud_compute", + "_display_name", + } self._parallel = parallel self._host: str = host self._port: Optional[int] = port @@ -134,6 +143,7 @@ class LightningWork: # setattr_replacement is used by the multiprocessing runtime to send the latest changes to the main coordinator self._setattr_replacement: Optional[Callable[[str, Any], None]] = None self._name = "" + self._display_name = "" # The ``self._calls`` is used to track whether the run # method with a given set of input arguments has already been called. # Example of its usage: @@ -208,10 +218,22 @@ class LightningWork: return name in LightningWork._INTERNAL_STATE_VARS or not name.startswith("_") @property - def name(self): + def name(self) -> str: """Returns the name of the LightningWork.""" return self._name + @property + def display_name(self) -> str: + """Returns the display name of the LightningWork for the Admin UI in the cloud.""" + if self._display_name == "": + return self.name + return self._display_name + + @display_name.setter + def display_name(self, display_name: str) -> None: + """Setter for the display name of the LightningWork.""" + self._display_name = display_name + @property def cache_calls(self) -> bool: """Returns whether the ``run`` method should cache its input arguments and not run again when provided with