shahar1 commented on code in PR #61830:
URL: https://github.com/apache/airflow/pull/61830#discussion_r2812672692
##########
providers/google/src/airflow/providers/google/cloud/operators/compute.py:
##########
@@ -124,6 +124,9 @@ class
ComputeEngineInsertInstanceOperator(ComputeEngineBaseOperator):
:param timeout: The amount of time, in seconds, to wait for the request to
complete.
Note that if `retry` is specified, the timeout applies to each
individual attempt.
:param metadata: Additional metadata that is provided to the method.
+ :param recreate_if_different: When True, delete and recreate the instance
if
+ the existing machine type differs from the requested body. Defaults to
+ False, in which case differences are only logged.
Review Comment:
```suggestion
:param recreate_if_machine_type_different: When True, delete and
recreate the instance if
the existing machine type differs from the requested body. Defaults
to
False, in which case differences are only logged.
```
maybe, to make it explicitly clear?
##########
providers/google/src/airflow/providers/google/cloud/operators/compute.py:
##########
@@ -206,54 +211,123 @@ def _validate_all_body_fields(self) -> None:
if self._field_validator:
self._field_validator.validate(self.body)
+ def _extract_machine_type(self, value: str | None) -> str | None:
+ if not value:
+ return None
+ return value.split("/")[-1]
+
+ def _detect_instance_drift(self, existing: Instance) -> dict[str, Any]:
+ """Log machine type differences between the existing instance and the
requested body."""
Review Comment:
nit: it doesn't log, but it compares and returns :)
--
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]