def test_execute(self, mock_hook): op = AutoMLDeleteModelOperator( model_id=MODEL_ID, location=GCP_LOCATION, project_id=GCP_PROJECT_ID, task_id=TASK_ID, ) op.execute(context=None) mock_hook.return_value.delete_model.assert_called_once_with( location=GCP_LOCATION, metadata=None, model_id=MODEL_ID, project_id=GCP_PROJECT_ID, retry=None, timeout=None, )
import_dataset_task = AutoMLImportDataOperator( task_id="import_dataset_task", dataset_id=dataset_id, location=GCP_AUTOML_LOCATION, input_config=IMPORT_INPUT_CONFIG, ) MODEL["dataset_id"] = dataset_id create_model = AutoMLTrainModelOperator(task_id="create_model", model=MODEL, location=GCP_AUTOML_LOCATION) model_id = "{{ task_instance.xcom_pull('create_model', key='model_id') }}" delete_model_task = AutoMLDeleteModelOperator( task_id="delete_model_task", model_id=model_id, location=GCP_AUTOML_LOCATION, project_id=GCP_PROJECT_ID, ) delete_datasets_task = AutoMLDeleteDatasetOperator( task_id="delete_datasets_task", dataset_id=dataset_id, location=GCP_AUTOML_LOCATION, project_id=GCP_PROJECT_ID, ) create_dataset_task >> import_dataset_task >> create_model >> delete_model_task >> delete_datasets_task