You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We currently have scriptworker.config.freeze_values that takes a dict, and changes any list values to tuples, and any dict values to frozendicts. This is useful to avoid inadvertent changes to runtime config.
This was sufficient as long as the config wasn't nested. That isn't true anymore.
In several places in the tests I do dict(deepcopy(config)) and do a for loop to change all frozendicts to dicts for json serialization. A reverse function, to recursively unfreeze a frozendict, might be useful, as long as it's very carefully used.
We can either write our own recursive freeze_values or copy/modify mozharness' ReadOnlyDict:
Write our own
we'll need to freeze from the bottom up, since freezing a top level dict and then modifying its values won't work
we'll need to unfreeze from the top down, since trying to unfreeze a child with a locked parent won't work
Copy mozharness' ReadOnlyDict
MPL2, so easy to drop in. We may want to allow for un-freezing, or make sure a deepcopy returns a read-write dict.
I don't expect to get to this before 1.0.0. Filing in case someone else is interested.
The text was updated successfully, but these errors were encountered:
We currently have
scriptworker.config.freeze_values
that takes a dict, and changes any list values to tuples, and any dict values tofrozendict
s. This is useful to avoid inadvertent changes to runtime config.This was sufficient as long as the config wasn't nested. That isn't true anymore.
In several places in the tests I do
dict(deepcopy(config))
and do a for loop to change allfrozendict
s to dicts for json serialization. A reverse function, to recursively unfreeze afrozendict
, might be useful, as long as it's very carefully used.We can either write our own recursive
freeze_values
or copy/modify mozharness'ReadOnlyDict
:Write our own
Copy mozharness'
ReadOnlyDict
MPL2, so easy to drop in. We may want to allow for un-freezing, or make sure a
deepcopy
returns a read-write dict.I don't expect to get to this before 1.0.0. Filing in case someone else is interested.
The text was updated successfully, but these errors were encountered: