-
Notifications
You must be signed in to change notification settings - Fork 5
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
Preserve workload resources structure on serialization #133
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you base the test on the (apparently unused!) step_with_resources
fixture (i.e. step-with-resources.yaml
) that was added in #121? When using our examples fixtures, we automagically do both direct and round-tripped variants of the test. As I see it, that should surface the bug.
Workload resource keys ("cpu", "memory", etc.) need to be preserved so that the UI can correctly parse the resource values.
724207c
to
be3cbc4
Compare
assert isinstance(resources, dict), "Resources should be defined." | ||
assert "cpu" in resources, "Resources should contain data." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These lines serve more to demonstrate the serialized result than to actually test the process – without the fix, the serialization crashes before reaching here.
Right. Done, pushed a rebased commit (without the unneeded new test data). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good stuff!
Related to https://github.com/valohai/meta/issues/275
Workload resource keys (
cpu
,memory
, etc.) need to be preserved so that the UI can correctly parse the resource values.Serialized resources in step before:
After:
The default for most keys (all of them so far) is to flatten them, which is why the test is a bit backwards (
not in [do_not_flatten]
instead ofkey in [do_flatten]
).