crooked-lifeguard-46802
05/30/2024, 3:54 PMtask
vs dynamic
or workflow
What I am really trying to do:
• I have a sprawling workflow, that has multiple nested dynamics
• Passing large lists/dataclasses through multiple levels of the nesting seems to slow the UI down significantly
• I already have a TypeTransformer that creates a compact representation of the large inputs (by having users apply a custom decorator to the type definitoin of their large inputs)
◦ But for better inspectibility, I would like to expand the compact representation back into the original flyte representation, but only on task
Is that possible?freezing-airport-6809
crooked-lifeguard-46802
05/30/2024, 4:13 PMdef to_literal(
self,
ctx: FlyteContext,
python_val: PickleDataClassMixin,
python_type: Type[PickleDataClassMixin],
expected: LiteralType,
) -> Literal:
path = persist_python_value(python_val)
json_repr = maybe_get_json_repr(python_val)
blob_literal = Literal(
scalar=Scalar(blob=Blob(uri=path, metadata=BlobMetadata(type=self._TYPE_INFO)))
)
if json_repr is None:
literal = Literal(map=LiteralMap(literals={"pickle_path": blob_literal}))
else:
structure_literal = Literal(
scalar=Scalar(generic=_json_format.Parse(json_repr, _struct.Struct())),
)
literal = Literal(
map=LiteralMap(
literals={"pickle_path": blob_literal, "structure": structure_literal}
)
)
return literal
In this example:
• the transformer returns dict(pickle_path=blob_literal, structure=structure_literal)
if the object is json serializable, else returns dict(pickle_path=blob_literal)
• The to_python_value
method only uses the pickle_path
to convert back into python object
This works quite well - objects with a json repr show up with both pickle_path
and structure
attribute in flyte console (see screenshot 1)
What I’d like to do is to switch between pickle_path + structure
and only pickle_path
based on if the literal is being created to be passed into a task
vs dynamic
(hope that makes it more clear, I am not trying to mutate types, just their representations in the UI)crooked-lifeguard-46802
06/11/2024, 1:56 PMfreezing-airport-6809
thankful-minister-83577
thankful-minister-83577
thankful-minister-83577
thankful-minister-83577
crooked-lifeguard-46802
06/13/2024, 1:08 PMhowever, what’s the core issue here though? Is it just UI performance?Yes, this is especially worse when trying to run an HPO where one could want to spawn 100s of sub-workflows to train models across different hyperparameters
freezing-airport-6809
crooked-lifeguard-46802
06/13/2024, 2:10 PMcan you jump on to union serverless and try thisHappy to! Should I join the waitlist from here: https://signup.union.ai/?
crooked-lifeguard-46802
06/13/2024, 2:25 PM