@@ -148,7 +148,7 @@ def from_flyte_idl(cls, pb2_objct):
148148
149149class NodeMetadata (_common .FlyteIdlEntity ):
150150
151- def __init__ (self , name , timeout , retries ):
151+ def __init__ (self , name , timeout , retries , interruptible = False ):
152152 """
153153 Defines extra information about the Node.
154154
@@ -159,6 +159,7 @@ def __init__(self, name, timeout, retries):
159159 self ._name = name
160160 self ._timeout = timeout
161161 self ._retries = retries
162+ self ._interruptible = interruptible
162163
163164 @property
164165 def name (self ):
@@ -181,11 +182,18 @@ def retries(self):
181182 """
182183 return self ._retries
183184
185+ @property
186+ def interruptible (self ):
187+ """
188+ :rtype: flytekit.models.
189+ """
190+ return self ._interruptible
191+
184192 def to_flyte_idl (self ):
185193 """
186194 :rtype: flyteidl.core.workflow_pb2.NodeMetadata
187195 """
188- node_metadata = _core_workflow .NodeMetadata (name = self .name , retries = self .retries .to_flyte_idl ())
196+ node_metadata = _core_workflow .NodeMetadata (name = self .name , retries = self .retries .to_flyte_idl (), interruptible = self . interruptible )
189197 node_metadata .timeout .FromTimedelta (self .timeout )
190198 return node_metadata
191199
@@ -458,10 +466,34 @@ def from_flyte_idl(cls, pb2_object):
458466 """
459467 return cls ()
460468
469+ class WorkflowMetadataDefaults (_common .FlyteIdlEntity ):
470+
471+ def __init__ (self , interruptible = None ):
472+ """
473+ Metadata Defaults for the workflow.
474+ """
475+ self .interruptible_ = interruptible
476+
477+ def to_flyte_idl (self ):
478+ """
479+ :rtype: flyteidl.core.workflow_pb2.WorkflowMetadataDefaults
480+ """
481+ return _core_workflow .WorkflowMetadataDefaults (
482+ interruptible = self .interruptible_
483+ )
484+
485+ @classmethod
486+ def from_flyte_idl (cls , pb2_object ):
487+ """
488+ :param flyteidl.core.workflow_pb2.WorkflowMetadataDefaults pb2_object:
489+ :rtype: WorkflowMetadata
490+ """
491+ return cls (interruptible = pb2_object .interruptible )
492+
461493
462494class WorkflowTemplate (_common .FlyteIdlEntity ):
463495
464- def __init__ (self , id , metadata , interface , nodes , outputs , failure_node = None ):
496+ def __init__ (self , id , metadata , metadata_defaults , interface , nodes , outputs , failure_node = None ):
465497 """
466498 A workflow template encapsulates all the task, branch, and subworkflow nodes to run a statically analyzable,
467499 directed acyclic graph. It contains also metadata that tells the system how to execute the workflow (i.e.
@@ -470,6 +502,7 @@ def __init__(self, id, metadata, interface, nodes, outputs, failure_node=None):
470502 :param flytekit.models.core.identifier.Identifier id: This is an autogenerated id by the system. The id is
471503 globally unique across Flyte.
472504 :param WorkflowMetadata metadata: This contains information on how to run the workflow.
505+ :param WorkflowMetadataDefaults metadata_defaults: This contains the default information on how to run the workflow.
473506 :param flytekit.models.interface.TypedInterface interface: Defines a strongly typed interface for the
474507 Workflow (inputs, outputs). This can include some optional parameters.
475508 :param list[Node] nodes: A list of nodes. In addition, "globals" is a special reserved node id that
@@ -485,6 +518,7 @@ def __init__(self, id, metadata, interface, nodes, outputs, failure_node=None):
485518 """
486519 self ._id = id
487520 self ._metadata = metadata
521+ self ._metadata_defaults = metadata_defaults
488522 self ._interface = interface
489523 self ._nodes = nodes
490524 self ._outputs = outputs
@@ -506,6 +540,14 @@ def metadata(self):
506540 """
507541 return self ._metadata
508542
543+ @property
544+ def metadata_defaults (self ):
545+ """
546+ This contains information on how to run the workflow.
547+ :rtype: WorkflowMetadataDefaults
548+ """
549+ return self ._metadata_defaults
550+
509551 @property
510552 def interface (self ):
511553 """
@@ -552,6 +594,7 @@ def to_flyte_idl(self):
552594 return _core_workflow .WorkflowTemplate (
553595 id = self .id .to_flyte_idl (),
554596 metadata = self .metadata .to_flyte_idl (),
597+ metadata_defaults = self .metadata_defaults .to_flyte_idl (),
555598 interface = self .interface .to_flyte_idl (),
556599 nodes = [n .to_flyte_idl () for n in self .nodes ],
557600 outputs = [o .to_flyte_idl () for o in self .outputs ],
@@ -567,6 +610,7 @@ def from_flyte_idl(cls, pb2_object):
567610 return cls (
568611 id = _identifier .Identifier .from_flyte_idl (pb2_object .id ),
569612 metadata = WorkflowMetadata .from_flyte_idl (pb2_object .metadata ),
613+ metadata_defaults = WorkflowMetadataDefaults .from_flyte_idl (pb2_object .metadata_defaults ),
570614 interface = _interface .TypedInterface .from_flyte_idl (pb2_object .interface ),
571615 nodes = [Node .from_flyte_idl (n ) for n in pb2_object .nodes ],
572616 outputs = [_Binding .from_flyte_idl (b ) for b in pb2_object .outputs ],
0 commit comments