airflow.providers.amazon.aws.sensors.batch

BatchSensor

轮询 Batch 作业的状态,直到其达到终止状态;如果作业失败,则失败。

BatchComputeEnvironmentSensor

轮询 Batch 环境的状态,直到其达到终止状态;如果环境失败,则失败。

BatchJobQueueSensor

轮询 Batch 作业队列的状态,直到其达到终止状态;如果队列失败,则失败。

模块内容

airflow.providers.amazon.aws.sensors.batch.BatchSensor(*, job_id, deferrable=conf.getboolean('operators', 'default_deferrable', fallback=False), poke_interval=30, max_retries=4200, **kwargs)[source]

基类: airflow.providers.amazon.aws.sensors.base_aws.AwsBaseSensor[airflow.providers.amazon.aws.hooks.batch_client.BatchClientHook]

轮询 Batch 作业的状态,直到其达到终止状态;如果作业失败,则失败。

另见

有关如何使用此 sensor 的更多信息,请参阅指南: 等待 AWS Batch 作业状态

参数:
  • job_id (str) – 要检查状态的 Batch 作业 ID

  • aws_conn_id – 用于 AWS 凭证的 Airflow 连接。如果此参数为 None 或为空,则使用默认的 boto3 行为。如果在分布式模式下运行 Airflow 且 aws_conn_id 为 None 或为空,则将使用默认的 boto3 配置(且必须在每个 worker 节点上维护)。

  • region_name – AWS 区域名称。如果未指定,则使用默认的 boto3 行为。

  • verify – 是否验证 SSL 证书。参见: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/core/session.html

  • deferrable (bool) – 在 deferrable 模式下运行 sensor。

  • poke_interval (float) – 轮询周期(秒),用于检查作业状态。

  • max_retries (int) – 在返回当前状态之前轮询作业状态的次数。

aws_hook_class[source]
template_fields: collections.abc.Sequence[str][source]
template_ext: collections.abc.Sequence[str] = ()[source]
ui_color = '#66c3ff'[source]
job_id[source]
deferrable = True[source]
poke_interval = 30[source]
max_retries = 4200[source]
poke(context)[source]

在派生此类时重写。

execute(context)[source]

创建算子时派生。

执行任务的主要方法。Context 是与渲染 jinja 模板时相同的字典。

有关更多上下文,请参阅 get_template_context。

execute_complete(context, event)[source]

当触发器触发时执行 - 立即返回。

依赖触发器抛出异常,否则假定执行成功。

airflow.providers.amazon.aws.sensors.batch.BatchComputeEnvironmentSensor(compute_environment, **kwargs)[source]

基类: airflow.providers.amazon.aws.sensors.base_aws.AwsBaseSensor[airflow.providers.amazon.aws.hooks.batch_client.BatchClientHook]

轮询 Batch 环境的状态,直到其达到终止状态;如果环境失败,则失败。

另见

有关如何使用此 sensor 的更多信息,请参阅指南: 等待 AWS Batch 计算环境状态

参数:
  • compute_environment (str) – Batch 计算环境名称

  • aws_conn_id – 用于 AWS 凭证的 Airflow 连接。如果此参数为 None 或为空,则使用默认的 boto3 行为。如果在分布式模式下运行 Airflow 且 aws_conn_id 为 None 或为空,则将使用默认的 boto3 配置(且必须在每个 worker 节点上维护)。

  • region_name – AWS 区域名称。如果未指定,则使用默认的 boto3 行为。

  • verify – 是否验证 SSL 证书。参见: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/core/session.html

aws_hook_class[source]
template_fields: collections.abc.Sequence[str][source]
template_ext: collections.abc.Sequence[str] = ()[source]
ui_color = '#66c3ff'[source]
compute_environment[source]
poke(context)[source]

在派生此类时重写。

airflow.providers.amazon.aws.sensors.batch.BatchJobQueueSensor(job_queue, treat_non_existing_as_deleted=False, **kwargs)[source]

基类: airflow.providers.amazon.aws.sensors.base_aws.AwsBaseSensor[airflow.providers.amazon.aws.hooks.batch_client.BatchClientHook]

轮询 Batch 作业队列的状态,直到其达到终止状态;如果队列失败,则失败。

另见

有关如何使用此 sensor 的更多信息,请参阅指南: 等待 AWS Batch 作业队列状态

参数:
  • job_queue (str) – Batch 作业队列名称

  • treat_non_existing_as_deleted (bool) – 如果为 True,则不存在的 Batch 作业队列将被视为已删除队列,并作为有效情况处理。

  • aws_conn_id – 用于 AWS 凭证的 Airflow 连接。如果此参数为 None 或为空,则使用默认的 boto3 行为。如果在分布式模式下运行 Airflow 且 aws_conn_id 为 None 或为空,则将使用默认的 boto3 配置(且必须在每个 worker 节点上维护)。

  • region_name – AWS 区域名称。如果未指定,则使用默认的 boto3 行为。

  • verify – 是否验证 SSL 证书。参见: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/core/session.html

aws_hook_class[source]
template_fields: collections.abc.Sequence[str][source]
template_ext: collections.abc.Sequence[str] = ()[source]
ui_color = '#66c3ff'[source]
job_queue[source]
treat_non_existing_as_deleted = False[source]
poke(context)[source]

在派生此类时重写。

此条目有帮助吗?