Skip to content

Commit

Permalink
allow python interface to get the default inputs from launch plan
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleShao1016 committed Nov 22, 2024
1 parent b04bc8d commit 78d8ecb
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions flytekit/core/launch_plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ def create(
name=name,
workflow=workflow,
parameters=wf_signature_parameters,
python_interface=temp_interface,
fixed_inputs=fixed_lm,
schedule=schedule,
notifications=notifications,
Expand Down Expand Up @@ -334,6 +335,7 @@ def __init__(
workflow: _annotated_workflow.WorkflowBase,
parameters: _interface_models.ParameterMap,
fixed_inputs: _literal_models.LiteralMap,
python_interface: Optional[Interface] = None,
schedule: Optional[_schedule_model.Schedule] = None,
notifications: Optional[List[_common_models.Notification]] = None,
labels: Optional[_common_models.Labels] = None,
Expand All @@ -349,6 +351,7 @@ def __init__(
# Ensure fixed inputs are not in parameter map
parameters = {k: v for k, v in parameters.parameters.items() if k not in fixed_inputs.literals}
self._parameters = _interface_models.ParameterMap(parameters=parameters)
self._python_interface = python_interface
self._fixed_inputs = fixed_inputs
# See create() for additional information
self._saved_inputs: Dict[str, Any] = {}
Expand All @@ -362,13 +365,13 @@ def __init__(
self._security_context = security_context
self._trigger = trigger
self._overwrite_cache = overwrite_cache

FlyteEntities.entities.append(self)

def clone_with(
self,
name: str,
parameters: Optional[_interface_models.ParameterMap] = None,
python_interface: Optional[Interface] = None,
fixed_inputs: Optional[_literal_models.LiteralMap] = None,
schedule: Optional[_schedule_model.Schedule] = None,
notifications: Optional[List[_common_models.Notification]] = None,
Expand All @@ -384,6 +387,7 @@ def clone_with(
name=name,
workflow=self.workflow,
parameters=parameters or self.parameters,
python_interface=python_interface or self.python_interface,
fixed_inputs=fixed_inputs or self.fixed_inputs,
schedule=schedule or self.schedule,
notifications=notifications or self.notifications,
Expand All @@ -402,7 +406,7 @@ def overwrite_cache(self) -> Optional[bool]:

@property
def python_interface(self) -> Interface:
return self.workflow.python_interface
return self._python_interface if self._python_interface else self.workflow.python_interface

@property
def interface(self) -> _interface_models.TypedInterface:
Expand Down

0 comments on commit 78d8ecb

Please sign in to comment.