使用 Airflow 运算符将运行时版本传递给 CMLE

Passing runtime version using Airflow operator to CMLE

我正在使用 MLEngine operator in contrib(在 none 贡献中找不到)。日志中的问题是 运行time error 未正确设置然后默认为 1.0.

File "/root/.local/lib/python2.7/site-packages/trainer/model.py", line 210, in train_and_evaluate estimator = tf.estimator.Estimator(model_fn = image_classifier, AttributeError: 'module' object has no attribute 'estimator'

我认为这表明我应该使用 TF 1.8,正如我在触发器中所指出的那样:

MLEngineTrainingOperator(
    task_id='ml_engine_training_op1',
    project_id=PROJECT_ID,
    job_id=job_id,
    package_uris=["gs://us-central1-ml-engine-deplo-0bf17ff3-bucket/trainer-0.1.tar.gz"],
    training_python_module=MODULE_NAME,
    training_args=training_args,
    region=REGION,
    scale_tier='BASIC',
    runtime_version = '1.8',
    dag=dag
)

并且在 Airflow 日志中:

PendingDeprecationWarning: Invalid arguments were passed to MLEngineTrainingOperator. Support for passing such arguments will be dropped in Airflow 2.0. Invalid arguments were: *args: () **kwargs: {'runtime_version': '1.8'}

Cloud Composer 运行 的气流版本是 1.9。

我的问题是使用运算符将​​ 运行time 版本传递给 CMLE 的正确方法是什么?

Airflow v1.9.0 中的 MLEngineTrainingOperator 不支持 runtime_version 作为参数。

但是,Airflow v1.10.0 中确实存在 runtime_version 参数。您可以使用 Composer Beta 通过检查 Composer UI.

右上角的 Enable Beta Features 创建 Airflow v.1.10.0

参考:

Airflow v1.9.0 mlengine_operator.py

Airflow v1.10.0 mlengine_operator.py