@@ -465,7 +465,7 @@ def _start(self, reconnect: bool = False) -> bool:
465
465
466
466
logger .debug ("Starting run" )
467
467
468
- if self ._sv_obj :
468
+ if self ._sv_obj and self . _sv_obj . status != "running" :
469
469
self ._sv_obj .status = self ._status
470
470
self ._sv_obj .commit ()
471
471
@@ -565,6 +565,7 @@ def init(
565
565
folder : typing .Annotated [
566
566
str , pydantic .Field (None , pattern = FOLDER_REGEX )
567
567
] = None ,
568
+ notification : typing .Literal ["none" , "all" , "error" , "lost" ] = "none" ,
568
569
running : bool = True ,
569
570
retention_period : str | None = None ,
570
571
timeout : int | None = 180 ,
@@ -586,6 +587,9 @@ def init(
586
587
description of the run, by default None
587
588
folder : str, optional
588
589
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"
589
593
running : bool, optional
590
594
whether to set the status as running or created, the latter implying
591
595
the run will be commenced at a later time. Default is True.
@@ -686,6 +690,7 @@ def init(
686
690
self ._sv_obj .tags = tags
687
691
self ._sv_obj .metadata = (metadata or {}) | git_info (os .getcwd ()) | environment ()
688
692
self ._sv_obj .heartbeat_timeout = timeout
693
+ self ._sv_obj .notifications = notification
689
694
690
695
if self ._status == "running" :
691
696
self ._sv_obj .system = get_system ()
0 commit comments