fix(user_tools): replace deprecated prop containers - #2105
Conversation
Signed-off-by: WilliamK112 <164879897+WilliamK112@users.noreply.github.com>
Greptile SummaryThis PR replaces two in-memory
Confidence Score: 4/5Safe to merge — the two targeted call-sites are correctly migrated and the API contract is preserved; the remaining deprecated usages in the same file are pre-existing and unrelated to this change's correctness. The substitution from JSONPropertiesContainer to AbstractPropContainer is straightforward: both expose identical get_value / get_value_silent methods, and the new class is a Pydantic BaseModel that accepts Any for its props field, so no downstream call-sites break. The new regression tests verify correct types and absence of warnings on both fixed paths. The only gap is that three other JSONPropertiesContainer usages remain in dataproc.py, meaning the deprecation warning still fires on the pricing and instance-description paths — a known scope limitation of this PR. dataproc.py still has three un-migrated JSONPropertiesContainer usages that will continue emitting deprecation warnings on the pricing config and instance-description code paths. Important Files Changed
Sequence Diagram%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant DPC as DataprocCluster._init_nodes
participant CI as ClusterInference.infer_cluster
participant APC as AbstractPropContainer
participant DN as DataprocNode
DPC->>APC: "AbstractPropContainer(props=raw_worker_prop)"
APC-->>DPC: worker_props container
DPC->>DN: "set_fields_from_dict({props: worker_props, ...})"
DN->>APC: get_value_silent('machineTypeUri')
APC-->>DN: instance type info
DPC->>APC: "AbstractPropContainer(props=raw_master_props)"
APC-->>DPC: master_props container
DPC->>DN: "set_fields_from_dict({props: master_props, ...})"
CI->>APC: "AbstractPropContainer(props=cluster_conf)"
APC-->>CI: cluster_props_new
CI->>CI: "platform.load_cluster_by_prop(cluster_props_new, is_inferred=True)"
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant DPC as DataprocCluster._init_nodes
participant CI as ClusterInference.infer_cluster
participant APC as AbstractPropContainer
participant DN as DataprocNode
DPC->>APC: "AbstractPropContainer(props=raw_worker_prop)"
APC-->>DPC: worker_props container
DPC->>DN: "set_fields_from_dict({props: worker_props, ...})"
DN->>APC: get_value_silent('machineTypeUri')
APC-->>DN: instance type info
DPC->>APC: "AbstractPropContainer(props=raw_master_props)"
APC-->>DPC: master_props container
DPC->>DN: "set_fields_from_dict({props: master_props, ...})"
CI->>APC: "AbstractPropContainer(props=cluster_conf)"
APC-->>CI: cluster_props_new
CI->>CI: "platform.load_cluster_by_prop(cluster_props_new, is_inferred=True)"
|
Signed-off-by: WilliamK112 <164879897+WilliamK112@users.noreply.github.com>
|
Greptile encountered an error while reviewing this PR. Please reach out to support@greptile.com for assistance. |
…-prop-container Signed-off-by: WilliamK112 <164879897+WilliamK112@users.noreply.github.com>
|
One JSON string path still needs to be handled. Could you parse |
Signed-off-by: WilliamK112 <164879897+WilliamK112@users.noreply.github.com>
|
Addressed in 1a91b80. Validation:
|
Description
Replace the remaining in-memory
JSONPropertiesContainerusages in Dataproc and cluster inference withAbstractPropContainer, removing the runtimeDeprecationWarningwhile preserving existing property access and JSON-string handling.The migration now covers:
Regression coverage exercises all four paths, verifies the new container type and existing outputs, and confirms that the deprecated-container warning is not emitted.
Fixes #1898.
Tests
PYTHONPATH=src .venv/bin/python -m pytest -q tests/spark_rapids_tools_ut/test_deprecated_prop_container.py(4 passed).venv/bin/python -m pylint -d fixme --load-plugins pylint_pydantic --rcfile=../.pylintrc src/spark_rapids_pytools/cloud_api/dataproc.py src/spark_rapids_pytools/common/cluster_inference.py tests/spark_rapids_tools_ut/test_deprecated_prop_container.py(10.00/10).venv/bin/python -m flake8 src/spark_rapids_pytools/cloud_api/dataproc.py src/spark_rapids_pytools/common/cluster_inference.py tests/spark_rapids_tools_ut/test_deprecated_prop_container.py.venv/bin/python -m py_compile src/spark_rapids_pytools/cloud_api/dataproc.py src/spark_rapids_pytools/common/cluster_inference.py tests/spark_rapids_tools_ut/test_deprecated_prop_container.pygit diff --check upstream/dev...HEAD