def test_execute(self, mock_import_data):
     op = AutoMLImportDataOperator(
         dataset_id=DATASET_ID,
         location=GCP_LOCATION,
         project_id=GCP_PROJECT_ID,
         input_config=INPUT_CONFIG,
         task_id=TASK_ID,
     )
     op.execute(context=None)
     mock_import_data.assert_called_once_with(
         input_config=INPUT_CONFIG,
         location=GCP_LOCATION,
         metadata=None,
         dataset_id=DATASET_ID,
         project_id=GCP_PROJECT_ID,
         retry=None,
         timeout=None,
     )
Example #2
0
        schedule_interval=None,  # Override to match your needs
        user_defined_macros={"extract_object_id": extract_object_id},
        tags=['example'],
) as example_dag:
    create_dataset_task = AutoMLCreateDatasetOperator(
        task_id="create_dataset_task",
        dataset=DATASET,
        location=GCP_AUTOML_LOCATION)

    dataset_id = (
        '{{ task_instance.xcom_pull("create_dataset_task", key="dataset_id") }}'
    )

    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,