-
Notifications
You must be signed in to change notification settings - Fork 660
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 in list default input error #5985
Comments
#take |
dataclass in dict default input doesn't work too. @dataclass
class DC:
ff: FlyteFile = field(default_factory=lambda: FlyteFile(os.path.realpath(__file__)))
sd: StructuredDataset = field(default_factory=lambda: StructuredDataset(
uri="/Users/future-outlier/code/dev/flytekit/build/debugyt/user/FE/src/data/df.parquet",
file_format="parquet"
))
fd: FlyteDirectory = field(default_factory=lambda: FlyteDirectory(
"/Users/future-outlier/code/dev/flytekit/build/debugyt/user/FE/src/data/"
))
@task(container_image=image)
def t1(dc: DC = DC()) -> DC:
with open(dc.ff, "r") as f:
print("File Content: ", f.read())
print("sd:", dc.sd.open(pd.DataFrame).all())
df_path = os.path.join(dc.fd.path, "df.parquet")
print("fd: ", os.path.isdir(df_path))
return dc
@workflow
def wf(dc: DC = DC()):
t1(dc=dc)
@task(container_image=image)
def list_t1(list_dc: list[DC] = [DC(), DC()]) -> list[DC]:
for dc in list_dc:
with open(dc.ff, "r") as f:
print("File Content: ", f.read())
print("sd:", dc.sd.open(pd.DataFrame).all())
df_path = os.path.join(dc.fd.path, "df.parquet")
print("fd: ", os.path.isdir(df_path))
return list_dc
@workflow
def list_wf(list_dc: list[DC] = [DC(), DC()]):
list_t1(list_dc=list_dc)
@task(container_image=image)
def dict_t1(dict_dc: dict[str, DC] = {"a": DC(), "b": DC()}) -> dict[str, DC]:
for _, dc in dict:
with open(dc.ff, "r") as f:
print("File Content: ", f.read())
print("sd:", dc.sd.open(pd.DataFrame).all())
df_path = os.path.join(dc.fd.path, "df.parquet")
print("fd: ", os.path.isdir(df_path))
return dict_dc
@workflow
def dict_wf(dict_dc: dict[str, DC] = {"a": DC(), "b": DC()}):
dict_t1(dict_dc=dict_dc) |
wait why are we touching the click types in the pr? I don't think click is being invoked. if you just run the first example in the description off of master flytekit, you will get the error This error should be fixed. It's coming from here: https://github.com/flyteorg/flytekit/blob/e19bbcc1041df1b4826a6d66cad215bf13cad4fa/flytekit/core/promise.py#L1413. This was added by flyteorg/flytekit#2522 when we wanted to start supporting positional But it doesn't work. Instead I get another error
can we make this issue capture/address both? |
Got it, I also found that errors. |
thank you. |
@Future-Outlier There seems to be a syntax error in the @wild-endeavor I noticed that, in addition to the Here are the errors I encountered while trying the cases mentioned above:
Here are the results after making the revisions: |
Describe the bug
The following example should work, maybe there's something wrong with how we handle
click types
input.Expected behavior
it should work.
Additional context to reproduce
env:
python 3.12, flytekit master branch
flyte backend: master branch
Screenshots
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: