@@ -119,7 +119,16 @@ def __init__(
119119 " in the next version. Use `cache_calls` instead."
120120 )
121121 self ._cache_calls = run_once if run_once is not None else cache_calls
122- self ._state = {"_host" , "_port" , "_url" , "_future_url" , "_internal_ip" , "_restarting" , "_cloud_compute" }
122+ self ._state = {
123+ "_host" ,
124+ "_port" ,
125+ "_url" ,
126+ "_future_url" ,
127+ "_internal_ip" ,
128+ "_restarting" ,
129+ "_cloud_compute" ,
130+ "_display_name" ,
131+ }
123132 self ._parallel = parallel
124133 self ._host : str = host
125134 self ._port : Optional [int ] = port
@@ -129,6 +138,7 @@ def __init__(
129138 # setattr_replacement is used by the multiprocessing runtime to send the latest changes to the main coordinator
130139 self ._setattr_replacement : Optional [Callable [[str , Any ], None ]] = None
131140 self ._name = ""
141+ self ._display_name = ""
132142 # The ``self._calls`` is used to track whether the run
133143 # method with a given set of input arguments has already been called.
134144 # Example of its usage:
@@ -207,6 +217,22 @@ def name(self):
207217 """Returns the name of the LightningWork."""
208218 return self ._name
209219
220+ @property
221+ def display_name (self ):
222+ """Returns the display name of the LightningWork in the cloud.
223+
224+ The display name needs to set before the run method of the work is called.
225+ """
226+ return self ._display_name
227+
228+ @display_name .setter
229+ def display_name (self , display_name : str ):
230+ """Sets the display name of the LightningWork in the cloud."""
231+ if not self .has_started :
232+ self ._display_name = display_name
233+ elif self ._display_name != display_name :
234+ raise RuntimeError ("The display name can be set only before the work has started." )
235+
210236 @property
211237 def cache_calls (self ) -> bool :
212238 """Returns whether the ``run`` method should cache its input arguments and not run again when provided with
0 commit comments