shahar1 commented on code in PR #66979:
URL: https://github.com/apache/airflow/pull/66979#discussion_r3246297382
##########
providers/google/src/airflow/providers/google/cloud/hooks/vertex_ai/ray.py:
##########
@@ -115,7 +115,7 @@ def create_ray_cluster(
"""
aiplatform.init(project=project_id, location=location,
credentials=self.get_credentials())
cluster_path = vertex_ray.create_ray_cluster(
- head_node_type=head_node_type,
+ head_node_type=head_node_type if head_node_type is not None else
resources.Resources(),
Review Comment:
Added in 9078e2a0da —
`TestRayWithDefaultProjectIdHook.test_create_ray_cluster_default_head_node_type`
calls `create_ray_cluster` with `head_node_type=None` and asserts that the
`head_node_type` kwarg forwarded to `vertex_ray.create_ray_cluster` is an
instance of `Resources`.
---
Drafted-by: Claude Code (claude-sonnet-4-6); reviewed by @shahar1 before
posting
##########
providers/google/src/airflow/providers/google/cloud/operators/vertex_ai/ray.py:
##########
@@ -155,7 +155,7 @@ def __init__(
**kwargs,
) -> None:
super().__init__(*args, **kwargs)
- self.head_node_type = head_node_type
+ self.head_node_type = head_node_type if head_node_type is not None
else resources.Resources()
Review Comment:
Added in 9078e2a0da — new file
`providers/google/tests/unit/google/cloud/operators/vertex_ai/test_ray.py` with
`TestCreateRayClusterOperator`:
- `test_create_ray_cluster_default_head_node_type_is_fresh_resources` — two
operator instances constructed without `head_node_type` each get a distinct
`Resources()` instance, confirming no shared mutable default.
- `test_execute_without_head_node_type_passes_default_resources` — calling
`execute()` on an operator constructed without `head_node_type` passes a
`Resources` instance as `head_node_type` to the hook.
---
Drafted-by: Claude Code (claude-sonnet-4-6); reviewed by @shahar1 before
posting
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]