update
This commit is contained in:
parent
c4b27fb69c
commit
8331e24a3f
|
@ -110,8 +110,8 @@ celerybeat-schedule
|
|||
|
||||
# dotenv
|
||||
.env
|
||||
.env_staging
|
||||
.env_local
|
||||
.env.staging
|
||||
.env.local
|
||||
|
||||
# virtualenv
|
||||
.venv
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue