Skip to content
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

Unable to define a list of dictionaries in a schema dataclass #140

Closed
dustinblack opened this issue Nov 8, 2024 · 0 comments · Fixed by #141
Closed

Unable to define a list of dictionaries in a schema dataclass #140

dustinblack opened this issue Nov 8, 2024 · 0 comments · Fixed by #141
Labels
bug Something isn't working

Comments

@dustinblack
Copy link
Member

Describe the bug

When attempting to define a dataclass object as a list of dictionaries:

    latency_hist: typing.List[typing.Dict[str, str]]

A traceback is consistently encountered:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/arcaflow_plugin_sdk/schema.py", line 6794, in _resolve_list_annotation
    cls._resolve_abstract_type(
  File "/usr/local/lib/python3.9/site-packages/arcaflow_plugin_sdk/schema.py", line 6281, in _resolve_abstract_type
    result = cls._resolve(t, type_hints, path, scope)
  File "/usr/local/lib/python3.9/site-packages/arcaflow_plugin_sdk/schema.py", line 6342, in _resolve
    return cls._resolve_dict_annotation(t, type_hints, path, scope)
  File "/usr/local/lib/python3.9/site-packages/arcaflow_plugin_sdk/schema.py", line 6875, in _resolve_dict_annotation
    args[1], arg_hints[1], tuple(values_path), scope
IndexError: tuple index out of range

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/app/arcaflow_plugin_rtla/tests/test_arcaflow_plugin_rtla.py", line 3, in <module>
    import rtla_plugin
  File "/app/arcaflow_plugin_rtla/rtla_plugin.py", line 31, in <module>
    class StartTimerlatStep:
  File "/app/arcaflow_plugin_rtla/rtla_plugin.py", line 60, in StartTimerlatStep
    def run_timerlat(
  File "/usr/local/lib/python3.9/site-packages/arcaflow_plugin_sdk/plugin.py", line 143, in step_decorator
    scope = build_object_schema(outputs[response_id])
  File "/usr/local/lib/python3.9/site-packages/arcaflow_plugin_sdk/schema.py", line 7013, in build_object_schema
    r = _SchemaBuilder.resolve(t, scope)
  File "/usr/local/lib/python3.9/site-packages/arcaflow_plugin_sdk/schema.py", line 6271, in resolve
    return cls._resolve_abstract_type(t, t, tuple(path), scope)
  File "/usr/local/lib/python3.9/site-packages/arcaflow_plugin_sdk/schema.py", line 6281, in _resolve_abstract_type
    result = cls._resolve(t, type_hints, path, scope)
  File "/usr/local/lib/python3.9/site-packages/arcaflow_plugin_sdk/schema.py", line 6324, in _resolve
    return cls._resolve_type(t, type_hints, path, scope)
  File "/usr/local/lib/python3.9/site-packages/arcaflow_plugin_sdk/schema.py", line 6377, in _resolve_type
    return cls._resolve_class(t, type_hints, path, scope)
  File "/usr/local/lib/python3.9/site-packages/arcaflow_plugin_sdk/schema.py", line 6569, in _resolve_class
    name, final_field = cls._resolve_dataclass_field(
  File "/usr/local/lib/python3.9/site-packages/arcaflow_plugin_sdk/schema.py", line 6409, in _resolve_dataclass_field
    underlying_type = cls._resolve_field(t.type, type_hints, path, scope)
  File "/usr/local/lib/python3.9/site-packages/arcaflow_plugin_sdk/schema.py", line 6308, in _resolve_field
    result = cls._resolve(t, type_hints, path, scope)
  File "/usr/local/lib/python3.9/site-packages/arcaflow_plugin_sdk/schema.py", line 6340, in _resolve
    return cls._resolve_list_annotation(t, type_hints, path, scope)
  File "/usr/local/lib/python3.9/site-packages/arcaflow_plugin_sdk/schema.py", line 6799, in _resolve_list_annotation
    raise SchemaBuildException(
arcaflow_plugin_sdk.schema.SchemaBuildException: Invalid schema definition for TimerlatOutput -> latency_hist: Failed to create list type
@dustinblack dustinblack added the bug Something isn't working label Nov 8, 2024
@dustinblack dustinblack linked a pull request Nov 8, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant