def test_execute(self, mock_delete_dataset):
     op = AutoMLDeleteDatasetOperator(
         dataset_id=DATASET_ID,
         location=GCP_LOCATION,
         project_id=GCP_PROJECT_ID,
         task_id=TASK_ID,
     )
     op.execute(context=None)
     mock_delete_dataset.assert_called_once_with(
         location=GCP_LOCATION,
         dataset_id=DATASET_ID,
         metadata=None,
         project_id=GCP_PROJECT_ID,
         retry=None,
         timeout=None,
     )
Example #2
0
        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
Example #3
0
    model_id = "{{ task_instance.xcom_pull('create_model_task', key='model_id') }}"
    # [END howto_operator_automl_create_model]

    # [START howto_operator_automl_delete_model]
    delete_model_task = AutoMLDeleteModelOperator(
        task_id="delete_model_task",
        model_id=model_id,
        location=GCP_AUTOML_LOCATION,
        project_id=GCP_PROJECT_ID,
    )
    # [END howto_operator_automl_delete_model]

    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  # noqa
        >> import_dataset_task  # noqa
        >> list_tables_spec_task  # noqa
        >> list_columns_spec_task  # noqa
        >> update_dataset_task  # noqa
        >> create_model_task  # noqa
        >> delete_model_task  # noqa
        >> delete_datasets_task  # noqa
    )