Comments (4)
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
- flyteidl/gen/pb_python/flyteidl/core/interface_pb2.pyi
- flyteidl/gen/pb_python/flyteidl/core/literals_pb2.py
- docs/user_guide/environment_setup.md
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.
Thank you for opening your first issue here! 🛠
from flyte.
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.
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)
- [BUG] rshift '>>' operator doesn't work properly with remoteEntities HOT 2
- [Core feature] Allow flytectl to set a targetExecutionCluster HOT 1
- [BUG] Boolean values within pydantic base model being casted to scalar value HOT 1
- [Housekeeping] Files used in `data_types_and_io.normalize_csv_file` and `data_types_and_io.download_and_normalize_csv_files` are no longer accessible HOT 6
- [Core feature] Default task resource behavior should apply for node level overrides HOT 3
- [Core feature] Update/register multiple launch plans with different inputs HOT 3
- [BUG] (Kubeflow) PyTorchPlugin sets Replicas to 0 casuing infinite loop HOT 7
- [BUG] regression: envFrom provided from pod template is discarded HOT 1
- [BUG] Relaunch workflow converts large numbers in array of structs to objects. HOT 5
- [BUG] `uri` of the input with `Any` type of the workflow is incorrect when run remotely HOT 3
- [BUG] Accessing attributes fails on complex types HOT 3
- [BUG] Plugin Collector does not include group HOT 4
- [BUG] Flyte v1.11.0 will fail to load the task's input & output ran by Flyte v1.3.2 HOT 1
- [BUG] Task errors are not directly surfaced in unit tests in 1.12.0 HOT 3
- [Docs] Help messages, error messages, and documentation for `pyflyte package` unfortunately result in a very bad first-time UX HOT 1
- [Core Feature] Local logs for local container task executions. HOT 1
- [BUG] Task should not attempt to retry if fails to deserialize the input HOT 2
- [BUG] Local `FlyteFile` whose name contains spaces fail in remote execution with "File Not Found" error
- [Housekeeping] Add support for protobuf version 5 in flytekit HOT 1
- [BUG] When triggering a remote LP, Flytekit fails with TypeError: 'NoneType' object is not subscriptable HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flyte.