Dipowell/node readiness timing - #1208
Conversation
791370e to
73ebe22
Compare
0b1cf21 to
4603b7b
Compare
There was a problem hiding this comment.
Pull request overview
This PR adds independent node-readiness timing to the Python AKS CRUD flow by extending the Kubernetes wait helper to optionally return a readiness timestamp, then running the ARM poller and the K8s readiness wait concurrently so both timings can be recorded for regression analysis.
Changes:
- Extend
KubernetesClient.wait_for_nodes_ready()withreturn_timestampto optionally return(ready_nodes, ready_timestamp). - Add concurrent ARM + K8s readiness execution in
AKSClientand recordnode_readiness_time/command_execution_timemetadata. - Update AKS and Kubernetes client unit tests to cover the new return shape and timing metadata recording.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| modules/python/clients/kubernetes_client.py | Adds return_timestamp option so callers can capture when nodes became Ready. |
| modules/python/clients/aks_client.py | Runs ARM and readiness concurrently and stores separate timing metadata. |
| modules/python/tests/clients/test_kubernetes_client.py | Adds a unit test validating the timestamp-returning behavior. |
| modules/python/tests/clients/test_aks_client.py | Updates tests to expect timestamp return and to assert timing metadata is recorded. |
a083a19 to
7c896e4
Compare
Use ThreadPoolExecutor instead of asyncio.run() to avoid implicit requirement that callers must not be in an existing event loop. Keeps the same method signature and behavior.
Move begin_create_or_update call and start_time capture inside the method. Callers now pass node_pool_name, cluster_name, parameters, and node_count instead of a pre-created poller and external timestamp.
Log now shows which layer (ARM vs K8s) was the bottleneck, the delta between them, and the total elapsed time for the concurrent operation.
This reverts commit 7c896e4.
ddf8598 to
d286aaf
Compare
|
Pylint |
fc4877b to
94bf515
Compare
…urred metadata - Extract instrument_nodepool_provisioning and begin_create_or_update_with_retry to utils/provisioning_instrumentation.py - Remove use_retry param: all call sites now use retry consistently - Add retry_occurred boolean metadata per reviewer feedback - aks_client.py: 1020 -> 958 lines (resolves pylint too-many-lines) - Add 8 unit tests for extracted module, 1 retry integration test
|
For reviewers only: reply |
Summary
Adds
node_readiness_timeas a separate metric in the open-source CRUD module to match internal repo behavior. The internal repo captures how long K8s nodes take to become Ready independently from when the ARM API completes. The open-source repo was missing this - it only had combined duration.Azure API says "done" when the control plane finishes, but nodes might not be schedulable yet. Capturing both timestamps separately enables regression analysis:
command_execution_time > node_readiness_time-> ARM layer is the bottlenecknode_readiness_time > command_execution_time-> K8s layer is the bottleneckChanges
utils/provisioning_instrumentation.py (new)
instrument_nodepool_provisioning()- runs ARM and K8s readiness concurrently viaThreadPoolExecutor, captures separate timing metadatabegin_create_or_update_with_retry()- ARM operation with retry onOperationNotAllowed/EtagMismatch, returnsretry_occurredbooleanclients/aks_client.py
_instrument_nodepool_provisioning()wrapper that builds callables and delegates to the extracted moduleuse_retryparametertoo-many-lines)clients/kubernetes_client.py
wait_for_nodes_ready()docstring to reflect actual return type and parameter namestests/utils/test_provisioning_instrumentation.py (new)
tests/clients/test_aks_client.py
test_create_node_pool_retry_occurred_metadatafor end-to-end retry verificationutils.provisioning_instrumentation.timefor timing assertionsTiming metadata stored via
op.add_metadata():node_readiness_time: seconds from start until K8s nodes were Readycommand_execution_time: seconds from start until ARM operation completedretry_occurred: boolean, True if ARM operation hit a transient error and retriedImplementation notes
ThreadPoolExecutor(max_workers=2)to run ARM polling and K8s readiness checks concurrentlyretry_occurredmetadata enables filtering skewedcommand_execution_timevalues from regression analysisaks_client.pyunder 1,000 lines without disabling pylint