flytekit icon indicating copy to clipboard operation
flytekit copied to clipboard

Add python interface to FlyteWorkflow

Open pingsutw opened this issue 1 year ago • 2 comments

Signed-off-by: Kevin Su [email protected]

TL;DR

fixes https://flyte-org.slack.com/archives/CP2HDHKE1/p1676916832851009?thread_ts=1676907633.986649&cid=CP2HDHKE1

Failed to run LP when the workflow type is FlyteWorklfow because there is no python_interface in the Flyteworkflow.

"/Users/ematus/test_flyte/flyte_remote.py", line 16, in <module>
    execution = remote.execute(lp, inputs={}, execution_name="test lanuch plan", wait=False) #fails here 'NoneType' object has no attribute 'inputs'
  File "/opt/homebrew/lib/python3.9/site-packages/flytekit/remote/remote.py", line 1107, in execute
    return self.execute_local_launch_plan(
  File "/opt/homebrew/lib/python3.9/site-packages/flytekit/remote/remote.py", line 1360, in execute_local_launch_plan
    type_hints=entity.python_interface.inputs,
AttributeError: 'NoneType' object has no attribute 'inputs'

we can use TypeEngine.guess_python_type to create python_interface by ourself.

Type

  • [x] Bug Fix
  • [ ] Feature
  • [ ] Plugin

Are all requirements met?

  • [x] Code completed
  • [x] Smoke tested
  • [x] Unit tests added
  • [ ] Code documentation added
  • [ ] Any pending items have an associated Issue

Complete description

from flytekit import LaunchPlan
from flytekit.remote import FlyteRemote
from flytekit.configuration import Config

remote = FlyteRemote(
    config=Config.auto("/Users/kevin/.flyte/config-remote.yaml"),
    default_project="flytesnacks",
    default_domain="development",
)

wf = remote.fetch_workflow(name="development.workflow.test.wf", version="8e689bb91ccbbfe63ca8112b527d0962", project="flytesnacks", domain="development")
lp = LaunchPlan.get_or_create(wf)
execution = remote.execute(lp, inputs={}, wait=False) #fails here 'NoneType' object has no attribute 'inputs'

Tracking Issue

https://github.com/flyteorg/flyte/issues/2977

Follow-up issue

NA

pingsutw avatar Oct 22 '22 00:10 pingsutw

Codecov Report

Merging #1252 (1ee7f04) into master (b3ad158) will decrease coverage by 0.01%. The diff coverage is 33.33%.

@@            Coverage Diff             @@
##           master    #1252      +/-   ##
==========================================
- Coverage   69.32%   69.32%   -0.01%     
==========================================
  Files         305      305              
  Lines       28671    28674       +3     
  Branches     2718     2720       +2     
==========================================
+ Hits        19877    19878       +1     
- Misses       8276     8278       +2     
  Partials      518      518              
Impacted Files Coverage Δ
flytekit/core/launch_plan.py 57.89% <ø> (ø)
flytekit/remote/remote.py 41.35% <33.33%> (-0.05%) :arrow_down:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

codecov[bot] avatar Oct 22 '22 00:10 codecov[bot]

@pingsutw I have a big pr in progress

kumare3 avatar Oct 25 '22 19:10 kumare3