-
Notifications
You must be signed in to change notification settings - Fork 674
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
[BUG] dataclass and pydantic both failed when using Flytekit Remote API #6081
Comments
Future-Outlier
added
bug
Something isn't working
untriaged
This issues has not yet been looked at by the Maintainers
labels
Dec 4, 2024
3 tasks
eapolinario
added
flytekit
FlyteKit Python related issue
and removed
untriaged
This issues has not yet been looked at by the Maintainers
labels
Dec 5, 2024
I will mentor my friend do this, let's go |
Actionable Step to solve this issue
import typing
import os
from dataclasses import dataclass, field
from typing import Dict, List
from enum import Enum
from flytekit import task, workflow, ImageSpec
flytekit_hash = "11fbd9aecd375cab70c79b581bdf4a28b37b4a41"
flytekit = f"git+https://github.com/flyteorg/flytekit.git@{flytekit_hash}"
image = ImageSpec(
packages=[flytekit,],
apt_packages=["git"],
registry="localhost:30000",
env={"FLYTE_USE_OLD_DC_FORMAT": "true"},
)
@dataclass
class DC:
a: int
@task(container_image=image)
def t1() -> DC:
return DC(a=5)
if __name__ == "__main__":
from flytekit.clis.sdk_in_container import pyflyte
from click.testing import CliRunner
import os
runner = CliRunner()
path = os.path.realpath(__file__)
result = runner.invoke(pyflyte.main, ["run", "--remote", path, "t1",])
print("Remote Execution: ", result.output)
from flytekit.remote.remote import FlyteRemote
from flytekit.configuration import Config
remote = FlyteRemote(
config=Config.for_endpoint("localhost:30080", True),
)
o = remote.get("flyte://v1/flytesnacks/development/a7g427xqqw94d222rsmz/easyexamplet1/o")
# o['o0'] this will fail
task_data = remote.fetch_task(project="flytesnacks", domain="development", name="easy_example.t1",)
print(task_data)
print(task_data.interface.outputs['o0'].type) # flytekit.models.types.LiteralType
# We can use `guess_python_type` to convert json schema (stored in the metadata to python types)
ref1: https://github.com/flyteorg/flyte/blob/b3330ba4430538f91ae9fc7d868a29a2e96db8bd/flyteadmin/dataproxy/service.go
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
Take dataclass as an example, if you use a
dataclass
as a task's input or output, and you use the flytekit remote API to fetch the result, you will get an error.example code
error
Expected behavior
This should work.
Additional context to reproduce
Screenshots
No response
Are you sure this issue hasn't been raised already?
Have you read the Code of Conduct?
The text was updated successfully, but these errors were encountered: