https://flyte.org logo
#announcements
Title
# announcements
m

Mike Ossareh

05/23/2022, 4:46 PM
I'm getting a typing complaint while writing an integration test for a workflow: ๐Ÿงต
This is broadly the test case:
Copy code
from our.codebase.task import task, OurParameterType, OurTaskResult

def test_our_task():
    @workflow
    def do_workflow(arg1: FlyteDirectory, arg2: OurParameterType) -> OurTaskResult:
        return task(arg1, arg2)

    arg1 = foo
    arg2 = bar

    ret: OurTaskResult = do_workflow(arg1, arg2)
Two typing issues occur: 1.
no parameter named arg2
2.
VoidPromise is incompatible with OurTaskResult
In the case of #1, is this some byproduct of the decorator? in the case of #2 should the return type of
do_work
be something else?
OurTaskResult
is essentially a:
Copy code
@dataclass_json
@dataclass
class FlyteResult:
  result: <our dc>
Where
our dc
is passed during module evaluation
e

Eduardo Apolinario (eapolinario)

05/23/2022, 5:07 PM
@Mike Ossareh. in the case of #1, workflows and tasks only accept named arguments. Can you try replacing the invocation of
do_workflow
with:
Copy code
do_workflow(arg1=arg1, arg2=arg2)
As for #2, this is a byproduct of the flytekit decorators. I think we can do something there, but will require a few changes.
m

Mike Ossareh

05/23/2022, 5:18 PM
Thanks @Eduardo Apolinario (eapolinario) - we actually are passing with keyword args - sorry, that was just me not being precise in my example
message has been deleted
and the definition:
e

Eduardo Apolinario (eapolinario)

05/23/2022, 5:21 PM
got it, thanks for clarifying. And just so I understand, the test fails or this is about the types not matching (and mypy complaining)?
m

Mike Ossareh

05/23/2022, 5:21 PM
mypy compaints
or, in this case, pyright
test passes just fine
e

Eduardo Apolinario (eapolinario)

05/23/2022, 5:22 PM
got it. Yeah, we'll need to make some changes to the workflow decorator to ensure mypy/pyright is happy.
Can you file an issue?
m

Mike Ossareh

05/23/2022, 5:22 PM
Will do
e

Eduardo Apolinario (eapolinario)

05/23/2022, 5:22 PM
thank you!
m

Mike Ossareh

05/23/2022, 5:25 PM
@Eduardo Apolinario (eapolinario) is this a bug or housekeeping? Feels like housekeeping honestly because things work
e

Eduardo Apolinario (eapolinario)

05/23/2022, 5:25 PM
I agree
๐Ÿ‘ 1
m

Mike Ossareh

05/23/2022, 5:56 PM
e

Eduardo Apolinario (eapolinario)

05/23/2022, 7:29 PM
Amazing, thanks. Will ping here when we figure out priorities. In the meantime, if you want to take a crack at it, please feel free.
๐Ÿ‘ 1
30 Views