Skip to content

Commit

Permalink
remove obsolete warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
mg515 committed Jul 30, 2024
1 parent 08f9a80 commit 709d4a4
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 45 deletions.
10 changes: 0 additions & 10 deletions plugins/flytekit-omegaconf/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,3 @@ SharedConfig.set_mode(OmegaConfTransformerMode.DictConfig)
Since the DictConfig is flattened and keys transformed into dot notation, the keys of the DictConfig must not contain
dots.
```

```note
Warning: This plugin overwrites the default serializer for Enum-objects to also allow for non-string-valued enum definitions.
Please check carefully if existing workflows are compatible with the new version.
```

```note
Warning: This plugin attempts serialisation of objects with different transformers. In the process exceptions during
serialisation are suppressed.
```
Original file line number Diff line number Diff line change
Expand Up @@ -91,22 +91,13 @@ def to_literal(self, ctx: FlyteContext, python_val: T, python_type: Type[T], exp
node_type, type_name = extract_node_type(python_val, key)
type_map[key] = type_name

transformation_logs = ""
transformer = TypeEngine.get_transformer(node_type)
literal_type = transformer.get_literal_type(node_type)

value_map[key] = MessageToDict(
transformer.to_literal(ctx, python_val[key], node_type, literal_type).to_flyte_idl()
)

if key not in value_map.keys():
raise ValueError(
f"Could not identify matching transformer for object {python_val[key]} of type "
f"{type(python_val[key])}. This may either indicate that no such transformer "
"exists or the appropriate transformer cannot serialise this object. Attempted the following "
f"transformers:\n{transformation_logs}"
)

wrapper = Struct()
wrapper.update(
flatten_dict.flatten(
Expand Down Expand Up @@ -145,18 +136,10 @@ def to_python_value(self, ctx: FlyteContext, lv: Literal, expected_python_type:
module_name, class_name = type_desc.rsplit(".", 1)
node_type = importlib.import_module(module_name).__getattribute__(class_name)

transformation_logs = ""
transformer = TypeEngine.get_transformer(node_type)
value_literal = Literal.from_flyte_idl(ParseDict(nested_dict["values"][key], PB_Literal()))
cfg_dict[key] = transformer.to_python_value(ctx, value_literal, node_type)

if key not in cfg_dict.keys():
raise ValueError(
f"Could not identify matching transformer for object {nested_dict['values'][key]} of "
f"proposed type {node_type}. This may either indicate that no such transformer "
"exists or the appropriate transformer cannot deserialise this object. Attempted the "
f"following transformers:\n{transformation_logs}"
)
if nested_dict["base_dataclass"] != "builtins.dict" and self.mode != OmegaConfTransformerMode.DictConfig:
# Explicitly instantiate dataclass and create DictConfig from there in order to have typing information
module_name, class_name = nested_dict["base_dataclass"].rsplit(".", 1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,21 +69,12 @@ def to_literal(self, ctx: FlyteContext, python_val: T, python_type: Type[T], exp
node_type, type_name = extract_node_type(python_val, idx)
type_list.append(type_name)

transformation_logs = ""
transformer = TypeEngine.get_transformer(node_type)
literal_type = transformer.get_literal_type(node_type)
value_list.append(
MessageToDict(transformer.to_literal(ctx, python_val[idx], node_type, literal_type).to_flyte_idl())
)

if len(type_list) != len(value_list):
raise ValueError(
f"Could not identify matching transformer for object {python_val[idx]} of type "
f"{type(python_val[idx])}. This may either indicate that no such transformer "
"exists or the appropriate transformer cannot serialise this object. Attempted the following "
f"transformers:\n{transformation_logs}"
)

wrapper = Struct()
wrapper.update({"types": type_list, "values": value_list})
return Literal(scalar=Scalar(generic=wrapper))
Expand All @@ -105,18 +96,9 @@ def to_python_value(self, ctx: FlyteContext, lv: Literal, expected_python_type:

value_literal = Literal.from_flyte_idl(ParseDict(value_list[i], PB_Literal()))

transformation_logs = ""
transformer = TypeEngine.get_transformer(node_type)
cfg_literal.append(transformer.to_python_value(ctx, value_literal, node_type))

if len(cfg_literal) != i + 1:
raise ValueError(
f"Could not identify matching transformer for object {value_literal[i]} of proposed type "
f"{node_type}. This may either indicate that no such transformer exists or the appropriate "
f"transformer cannot deserialise this object. Attempted the following "
f"transformers:\n{transformation_logs}"
)

return OmegaConf.create(cfg_literal)
raise TypeTransformerFailedError(f"Cannot convert from {lv} to {expected_python_type}")

Expand Down

0 comments on commit 709d4a4

Please sign in to comment.