Giter Club home page Giter Club logo

Comments (4)

dosubot avatar dosubot commented on June 13, 2024 2

The issue you're experiencing with flytekitplugins-pydantic when using a Pydantic type as an input parameter in the main workflow during remote execution seems to stem from the lv.map being None in the to_python_value method within basemodel_transformer.py. This method is crucial for converting protobuf Literal to Python values, especially for handling complex data structures through protobuf messages.

The discrepancy between local and remote execution could be influenced by various factors, including differences in environment configurations, dependency versions, or execution contexts. To address this, ensure that your remote environment closely mirrors your local setup, particularly in terms of dependency versions and configurations.

For a more targeted approach, it would be beneficial to have the exact error message encountered during the failure. This information could provide more insight into the root cause of the issue and facilitate a more precise solution.

If you have already ensured environment consistency and the problem persists, providing additional details about the error and any differences in the execution context between local and remote environments could help in diagnosing and resolving the issue more effectively.

Sources

About Dosu

This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.

from flyte.

welcome avatar welcome commented on June 13, 2024

Thank you for opening your first issue here! 🛠

from flyte.

artgramlich avatar artgramlich commented on June 13, 2024

In the example attached, the environments are the same. The actual error is:

`
[3/3] currentAttempt done. Last Error: SYSTEM::Traceback (most recent call last):

  File "/opt/venv/lib/python3.12/site-packages/flytekit/exceptions/scopes.py", line 178, in system_entry_point
    return wrapped(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.12/site-packages/flytekit/core/base_task.py", line 669, in dispatch_execute
    raise type(exc)(msg) from exc

Message:

AttributeError: Failed to convert inputs of task 'workflows.example.say_hello_complex':

'NoneType' object has no attribute 'literals'

`

Do some patching so the the underlying error is logged shows that it is caused by a null value.

`
[3/3] currentAttempt done. Last Error: SYSTEM::Traceback (most recent call last):

  File "/opt/venv/lib/python3.12/site-packages/flytekit/exceptions/scopes.py", line 178, in system_entry_point
    return wrapped(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.12/site-packages/flytekit/core/base_task.py", line 745, in dispatch_execute
    raise exc
  File "/opt/venv/lib/python3.12/site-packages/flytekit/core/base_task.py", line 741, in dispatch_execute
    native_inputs = self._literal_map_to_python_input(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.12/site-packages/flytekit/core/base_task.py", line 603, in _literal_map_to_python_input
    return TypeEngine.literal_map_to_kwargs(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.12/site-packages/flytekit/core/utils.py", line 309, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.12/site-packages/flytekit/core/type_engine.py", line 1195, in literal_map_to_kwargs
    kwargs[k] = TypeEngine.to_python_value(ctx, lm.literals[k], python_interface_inputs[k])
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.12/site-packages/flytekit/core/type_engine.py", line 1140, in to_python_value
    return transformer.to_python_value(ctx, lv, expected_python_type)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.12/site-packages/flytekitplugins/pydantic/basemodel_transformer.py", line 70, in to_python_value
    basemodel_literals: BaseModelLiterals = lv.map.literals
                                            ^^^^^^^^^^^^^^^

Message:

AttributeError: 'NoneType' object has no attribute 'literals'

SYSTEM ERROR! Contact platform administrators.
`

from flyte.

ai-rnatour avatar ai-rnatour commented on June 13, 2024

We're also seeing this error on 1.10.7 1.12.0. Here's a minimal example:

from flytekit import dynamic, task, workflow
from pydantic import BaseModel, PositiveInt


class Foo(BaseModel):
    x: PositiveInt


@task
def say_hello(*, foo: Foo) -> str:
    msg = f"Hello, {foo.x}!"
    print(msg)
    print(type(foo.x))
    return msg


@dynamic
def _say_hello_wf(*, foo: Foo) -> str:
    return say_hello(foo=foo)


@workflow
def say_hello_wf(*, foo: Foo) -> str:
    return _say_hello_wf(foo=foo)

I have tried this with pydantic 2.x (making sure to import the v1 BaseModel) and 1.x.

from flyte.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.