Inprocess: states and keys are serialized with json, not pickle#268
Inprocess: states and keys are serialized with json, not pickle#268hexinw-nvidia merged 3 commits intoNVIDIA:mainfrom
Conversation
Greptile SummaryThis PR replaces
Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant R as Rank N
participant S as TCPStore
participant P as Peer Ranks
Note over R: send_state (new JSON path)
R->>R: dataclasses.asdict(state)
R->>R: state_dict['mode'] = state.mode.name
R->>R: state_dict['fn_exception'] = None
R->>S: set(STATE_key, json.dumps(state_dict))
Note over R: send_key (new JSON path)
R->>S: set(KEY_key, json.dumps(key))
Note over P: get_states
P->>S: multi_get([STATE_key for each rank])
S-->>P: [json bytes, ...]
P->>P: json.loads(data) → state_dict
P->>P: state_dict['mode'] = Mode[name]
P->>P: State(**state_dict)
Note over P: get_keys
P->>S: multi_get([KEY_key for each rank])
S-->>P: [json bytes, ...]
P->>P: json.loads(data) → key (tuples become lists)
Last reviewed commit: c47d7b3 |
Additional Comments (2)
In the current code-path this is safe because Consider adding a comment to document this intentional trade-off:
If keys are always scalars (strings / integers) in practice, this is fine, but the change is silently breaking for callers using tuple or composite keys. Consider validating the key type or documenting the restriction: |
No description provided.