@@ -465,7 +465,7 @@ def _start(self, reconnect: bool = False) -> bool:
465465
466466 logger .debug ("Starting run" )
467467
468- if self ._sv_obj :
468+ if self ._sv_obj and self . _sv_obj . status != "running" :
469469 self ._sv_obj .status = self ._status
470470 self ._sv_obj .commit ()
471471
@@ -565,6 +565,7 @@ def init(
565565 folder : typing .Annotated [
566566 str , pydantic .Field (None , pattern = FOLDER_REGEX )
567567 ] = None ,
568+ notification : typing .Literal ["none" , "all" , "error" , "lost" ] = "none" ,
568569 running : bool = True ,
569570 retention_period : str | None = None ,
570571 timeout : int | None = 180 ,
@@ -586,6 +587,9 @@ def init(
586587 description of the run, by default None
587588 folder : str, optional
588589 folder within which to store the run, by default "/"
590+ notification: typing.Literal["none", "all", "error", "lost"], optional
591+ whether to notify the user by email upon completion of the run if
592+ the run is in the specified state, by default "none"
589593 running : bool, optional
590594 whether to set the status as running or created, the latter implying
591595 the run will be commenced at a later time. Default is True.
@@ -686,6 +690,7 @@ def init(
686690 self ._sv_obj .tags = tags
687691 self ._sv_obj .metadata = (metadata or {}) | git_info (os .getcwd ()) | environment ()
688692 self ._sv_obj .heartbeat_timeout = timeout
693+ self ._sv_obj .notifications = notification
689694
690695 if self ._status == "running" :
691696 self ._sv_obj .system = get_system ()
0 commit comments