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

Backfill should fill in the right input vars #1593

Merged
merged 4 commits into from
Apr 21, 2023
Merged
Changes from 1 commit
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
15 changes: 14 additions & 1 deletion flytekit/remote/backfill.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,27 @@ def create_backfill_workflow(
prev_node = None
actual_start = None
actual_end = None
if for_lp.interface.inputs and len(for_lp.interface.inputs.keys()) > 1:
raise ValueError(
f"LaunchPlan({for_lp.name}) should have either no or exactly one input, but found more "
f"- {for_lp.interface.inputs.keys()}"
)

input_name: typing.Optional[str] = None
if for_lp.interface.inputs and len(for_lp.interface.inputs.keys()) == 1:
input_name = list(for_lp.interface.inputs.keys())[0]

while True:
next_start_date = date_iter.get_next()
if not actual_start:
actual_start = next_start_date
if next_start_date >= end_date:
break
actual_end = next_start_date
next_node = wf.add_launch_plan(for_lp, t=next_start_date)
inputs = {}
if input_name:
inputs[input_name] = next_start_date
next_node = wf.add_launch_plan(for_lp, **inputs)
next_node = next_node.with_overrides(
name=f"b-{next_start_date}", retries=per_node_retries, timeout=per_node_timeout
)
Expand Down