best-architect-85296
07/12/2024, 7:00 AMpath
(/tmp/easfdasdfas) and not the _remote_source
(gs://flyte-asdfdasfd/asdfa). Is there a Flyte way to serialize objects to json and storing the _remote_source
for FlyteFile?damp-lion-88352
07/12/2024, 7:23 AMdamp-lion-88352
07/12/2024, 7:23 AM.remote_source
to get the value, and set your path's value in Flytefile.damp-lion-88352
07/12/2024, 7:24 AMpath
will be _remote_source
best-architect-85296
07/12/2024, 11:05 AMdamp-lion-88352
07/12/2024, 5:10 PMdamp-lion-88352
07/12/2024, 5:10 PMdamp-lion-88352
07/12/2024, 5:10 PMdamp-lion-88352
07/12/2024, 5:11 PMFlyteFiles's serialization method
unless you inherit FlyteFile and write your own codedamp-lion-88352
07/12/2024, 5:12 PMdamp-lion-88352
07/12/2024, 5:12 PMFltyeFile
damp-lion-88352
07/12/2024, 5:13 PMFlyteFile
's serialization and deserialization behaviour is different from FlyteFile
in dataclass.rich-garden-69988
07/12/2024, 9:40 PMclass FlyteFileSerialize(SerializationStrategy):
"""Class to serialize FlyteFile and maintain the remote path or source."""
def serialize(self, v: FlyteFile) -> dict[str, str]:
return {"path": str(v.remote_path or v.remote_source or v.path)}
def deserialize(self, v: dict[str, str]) -> FlyteFile:
return FlyteFile(v["path"])
@dataclass
class ExampleDataclass:
class Config:
"""Config defining serialization for mashumaro."""
serialization_strategy: ClassVar = {
FlyteFile: FlyteFileSerialize(),
}
damp-lion-88352
07/12/2024, 9:41 PMdamp-lion-88352
07/12/2024, 9:41 PMdamp-lion-88352
07/12/2024, 9:41 PMdamp-lion-88352
07/12/2024, 9:42 PMrich-garden-69988
07/12/2024, 9:43 PMSerializableType
abstraction so we can extend to other non-mashumaro supported types!rich-garden-69988
07/12/2024, 9:44 PMdamp-lion-88352
07/12/2024, 10:20 PMbest-architect-85296
07/22/2024, 11:50 AMdamp-lion-88352
07/22/2024, 3:23 PMdamp-lion-88352
07/22/2024, 3:23 PM