e-galan commented on code in PR #39752:
URL: https://github.com/apache/airflow/pull/39752#discussion_r1610768094
##########
tests/providers/google/cloud/operators/test_automl.py:
##########
@@ -379,63 +379,51 @@ def test_templating(self,
create_task_instance_of_operator):
assert task.impersonation_chain == "impersonation-chain"
-class TestAutoMLListColumnsSpecsOperator:
+class TestAutoMLTablesListColumnsSpecsOperator:
+ expected_deprecation_warning = (
+ "Class `AutoMLTablesListColumnSpecsOperator` has been deprecated and
will be removed after 31.12.2024. "
+ "AutoML platform no longer supports tabular datasets after its
integration with Cloud Translation and Vertex AI. "
+ "Please refer to
https://cloud.google.com/vertex-ai/docs/start/migrating-to-vertex-ai and "
+ "https://cloud.google.com/translate/docs/advanced/automl-upgrade for
more info about available alternatives."
+ )
+
@mock.patch("airflow.providers.google.cloud.operators.automl.CloudAutoMLHook")
def test_execute(self, mock_hook):
table_spec = "table_spec_id"
filter_ = "filter"
page_size = 42
- op = AutoMLTablesListColumnSpecsOperator(
- dataset_id=DATASET_ID,
- table_spec_id=table_spec,
- location=GCP_LOCATION,
- project_id=GCP_PROJECT_ID,
- field_mask=MASK,
- filter_=filter_,
- page_size=page_size,
- task_id=TASK_ID,
- )
- op.execute(context=mock.MagicMock())
- mock_hook.return_value.list_column_specs.assert_called_once_with(
- dataset_id=DATASET_ID,
- field_mask=MASK,
- filter_=filter_,
- location=GCP_LOCATION,
- metadata=(),
- page_size=page_size,
- project_id=GCP_PROJECT_ID,
- retry=DEFAULT,
- table_spec_id=table_spec,
- timeout=None,
- )
+ with pytest.raises(AirflowProviderDeprecationWarning,
match=self.expected_deprecation_warning):
Review Comment:
@Taragolis in this PR I followed the example of #38673 , which had been
approved by the community and merged. In that PR the operators that were no
longer working (`AutoMLTablesUpdateDatasetOperator` and
`AutoMLDeployModelOperator`) were deprecated with `action="error"` which will
raise an exception if we try to instantiate the operators or run their methods.
The operators that I'm trying to deprecate in this PR are also no longer
working (the corresponding AutoML functionality was disabled a couple months
ago, please read more in the PR desc), so I thought that I should follow the
same approach, and assigned `action="error"` in the deprecated decorator.
Because of this `pytest.warns` did not work in the unit tests, so I changed
it to `pytest.raises`. I also had to update the related unit tests, because the
operator methods started to raise the exceptions instead of working.
In one of your comments you suggest to remove `action="error"` because *if
users wanted they could configure it by Python builtin [Warnings
Control](https://docs.python.org/3/library/warnings.html#the-warnings-filter)
we should not force it to the to the error.*
I can do it, I just think there should be a single approach here. Meaning
that:
1) We can follow the example of #38673 , and in this case I don't need to
make the changes that you requested.
2) I can follow your suggestions, remove `action="error"` and make the
corresponding changes in the unit tests. Then I suppose I will need to do the
same for `AutoMLTablesUpdateDatasetOperator` and `AutoMLDeployModelOperator`.
What do you think?
--
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]