Skip to content

Add support FlyteFile in dataclass#710

Closed
pingsutw wants to merge 5 commits into
masterfrom
flytefile_in_dataclass-1
Closed

Add support FlyteFile in dataclass#710
pingsutw wants to merge 5 commits into
masterfrom
flytefile_in_dataclass-1

Conversation

@pingsutw

@pingsutw pingsutw commented Oct 20, 2021

Copy link
Copy Markdown
Member

Signed-off-by: Kevin Su pingsutw@apache.org

TL;DR

Add support FlyteFile in dataclass

Type

  • Bug Fix
  • Feature
  • Plugin

Are all requirements met?

  • Code completed
  • Smoke tested
  • Unit tests added
  • Code documentation added
  • Any pending items have an associated Issue

Complete description

Add additional metadata to serialize/deserialize FlyteFile.
Flyte Console:
image

Tracking Issue

https://github.com/lyft/flyte/issues/

Follow-up issue

NA

@codecov

codecov Bot commented Oct 20, 2021

Copy link
Copy Markdown

Codecov Report

Merging #710 (862248b) into master (b0da779) will increase coverage by 0.01%.
The diff coverage is 98.61%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #710      +/-   ##
==========================================
+ Coverage   85.80%   85.81%   +0.01%     
==========================================
  Files         358      362       +4     
  Lines       29793    30064     +271     
  Branches     2428     2454      +26     
==========================================
+ Hits        25564    25800     +236     
- Misses       3590     3621      +31     
- Partials      639      643       +4     
Impacted Files Coverage Δ
flytekit/types/file/file.py 90.84% <92.30%> (+0.06%) ⬆️
flytekit/core/type_engine.py 88.71% <100.00%> (+0.23%) ⬆️
tests/flytekit/unit/core/test_type_engine.py 99.73% <100.00%> (+0.01%) ⬆️
tests/flytekit/unit/core/test_type_hints.py 96.14% <100.00%> (+0.26%) ⬆️
flytekit/remote/remote.py 69.88% <0.00%> (-2.78%) ⬇️
flytekit/core/promise.py 77.95% <0.00%> (ø)
flytekit/common/translator.py 90.38% <0.00%> (ø)
...te/mock_flyte_repo/workflows/basic/subworkflows.py 82.35% <0.00%> (ø)
flytekit/types/pickle/__init__.py 100.00% <0.00%> (ø)
flytekit/types/pickle/pickle.py 86.53% <0.00%> (ø)
... and 8 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b0da779...862248b. Read the comment docs.

Signed-off-by: Kevin Su <pingsutw@apache.org>
Signed-off-by: Kevin Su <pingsutw@apache.org>
Signed-off-by: Kevin Su <pingsutw@apache.org>
Signed-off-by: Kevin Su <pingsutw@apache.org>
@pingsutw pingsutw force-pushed the flytefile_in_dataclass-1 branch from 3f9048d to 243d282 Compare October 26, 2021 09:32
@pingsutw pingsutw requested a review from eapolinario as a code owner October 26, 2021 09:32
@dataclass_json
@dataclass
class FlyteFile(os.PathLike, typing.Generic[T]):
path: str = field(metadata=config(mm_field=fields.String()))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need to specify metadata?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if I remove it, will get the below error.

{"asctime": "2021-10-28 20:12:39,540", "name": "flytekit", "levelname": "WARNING", "message": 
"failed to extract schema for object <class 'test_type_engine.TestFileStruct'>, (will run 
schemaless) error: unsupported field type <fields.Field(dump_default=<marshmallow.missing>, 
attribute=None, validate=None, required=False, load_only=False, dump_only=False, load_default=
<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required 
field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.'})>"}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's very wired, the error only happens with Flyte type.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where were you seeing this? Was it in the test_flyte_file_in_dataclass test?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

Comment thread tests/flytekit/unit/core/test_type_engine.py
Signed-off-by: Kevin Su <pingsutw@apache.org>
@pingsutw pingsutw mentioned this pull request Oct 28, 2021
8 tasks
@pingsutw pingsutw closed this Nov 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants