Skip to content

Commit

Permalink
Dictionary collector nodes no longer need keys to be str
Browse files Browse the repository at this point in the history
The collector electron now assembles the dictionary from two lists --
one list of keys, one list of corresponding values.
  • Loading branch information
cjao committed Dec 13, 2023
1 parent 6e331d4 commit ea4b9e4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed

- Reduced number of assets to upload when submitting a dispatch.
- The keys of dictionary inputs to electrons need not be keys.

### Operations

Expand Down
6 changes: 3 additions & 3 deletions covalent/_workflow/electron.py
Original file line number Diff line number Diff line change
Expand Up @@ -571,16 +571,16 @@ def _auto_list_node(*args, **kwargs):

elif isinstance(param_value, dict):

def _auto_dict_node(*args, **kwargs):
return dict(kwargs)
def _auto_dict_node(keys, values):
return {keys[i]: values[i] for i in range(len(keys))}

dict_electron = Electron(
function=_auto_dict_node,
metadata=collection_metadata,
task_group_id=self.task_group_id,
packing_tasks=True and active_lattice.task_packing,
) # Group the auto-generated node with the main node.
bound_electron = dict_electron(**param_value)
bound_electron = dict_electron(list(param_value.keys()), list(param_value.values()))
transport_graph.set_node_value(bound_electron.node_id, "name", electron_dict_prefix)
transport_graph.add_edge(
dict_electron.node_id,
Expand Down

0 comments on commit ea4b9e4

Please sign in to comment.