Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] allow python interface to get the default inputs from launch plan #2949

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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