Skip to content
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.

fix node serialization #1627

Merged
merged 5 commits into from
Jan 31, 2022
Merged

Conversation

chkeita
Copy link
Contributor

@chkeita chkeita commented Jan 28, 2022

Summary of the Pull Request

The tuple type of Node.tasks is causing the following error when the field is deserialized

WARNING:root:unable to normalize type f<class 'tuple'>
WARNING:root:unable to normalize type f<class 'tuple'>
WARNING:root:unable to normalize type f<class 'tuple'>
Traceback (most recent call last):
  File "C:\temp\onefuzz\venv\Scripts\onefuzz-script.py", line 11, in <module>
    load_entry_point('onefuzz', 'console_scripts', 'onefuzz')()
  File "c:\work\onefuzz\src\cli\onefuzz\__main__.py", line 16, in main
    return execute_api(Onefuzz(), [Endpoint, Command], __version__)
  File "c:\work\onefuzz\src\cli\onefuzz\cli.py", line 591, in execute_api
    output(result, args.format, expression)
  File "c:\work\onefuzz\src\cli\onefuzz\cli.py", line 532, in output
    result = json.dumps(result, indent=4, sort_keys=True)
  File "C:\Users\keita\AppData\Local\Programs\Python\Python38\lib\json\__init__.py", line 234, in dumps
    return cls(
  File "C:\Users\keita\AppData\Local\Programs\Python\Python38\lib\json\encoder.py", line 201, in encode
    chunks = list(chunks)
  File "C:\Users\keita\AppData\Local\Programs\Python\Python38\lib\json\encoder.py", line 431, in _iterencode
    yield from _iterencode_dict(o, _current_indent_level)
  File "C:\Users\keita\AppData\Local\Programs\Python\Python38\lib\json\encoder.py", line 405, in _iterencode_dict
    yield from chunks
  File "C:\Users\keita\AppData\Local\Programs\Python\Python38\lib\json\encoder.py", line 325, in _iterencode_list
    yield from chunks
  File "C:\Users\keita\AppData\Local\Programs\Python\Python38\lib\json\encoder.py", line 325, in _iterencode_list
    yield from chunks
  File "C:\Users\keita\AppData\Local\Programs\Python\Python38\lib\json\encoder.py", line 438, in _iterencode
    o = _default(o)
  File "C:\Users\keita\AppData\Local\Programs\Python\Python38\lib\json\encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type NodeTaskState is not JSON serializable

This PR changes the type of that field to NodeTask which is supported by our serialization layer.

@chkeita chkeita enabled auto-merge (squash) January 31, 2022 16:57
@chkeita chkeita merged commit 809db31 into microsoft:main Jan 31, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Mar 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants