-
Notifications
You must be signed in to change notification settings - Fork 2
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
Feature/support gradient arrays in firebase #275
Conversation
…ture/upload-gradient-arrays
elif key == "gradient" and isinstance(obj_data[key], list): | ||
new_grad_list = [] | ||
for grad in obj_data[key]: | ||
for name in grad: | ||
grad_dict[name] = grad[name] | ||
new_grad_list.append(name) | ||
obj_dict[obj_name][key] = new_grad_list |
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.
This section of code shares some similarities with def get_reference_in_obj()
in CompositionDoc
class, but they perform distinct tasks -- this one unpacks gradients for downloading, the latter resolves db references for duplicate checking while uploading. For clarity and easier maintenance, I'm going to leave them as standalone sections.
…ture/upload-gradient-arrays
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.
Tested out with the combined gradient recipe and it works for me!
Problem
What is the problem this work solves, including
closes #273
Solution
When gradient is a list of gradient names, e.g
"gradient": ["X_gradient","Y_gradient"]
, we need to add additional steps to our current upload+download system.Note: After adding logic to detect, unpack and resolve combined gradients in the corresponding steps of the process, our system can now upload and download the current test recipes in all contexts. I did notice an odd behavior (not breaking anything) with the recipe loader automatically adding a default
representation
to each object when downloading recipes from firebase, will write another issue to address this.Type of change
Please delete options that are not relevant.
Steps to Verify:
test_combined_gradient.json
related data. Delete them if they existupload -r cellpack/tests/recipes/v2/test_combined_gradient.json
pack firebase:recipes/test_combined_gradient_v_1.0.0