tests.system.openlineage.operator

属性

log

OpenLineageTestOperator

添加此操作符是为了进行系统测试。

函数

any(result)

is_datetime(result)

is_uuid(result)

regex_match(result, pattern)

env_var(var[, default])

使用此 jinja 方法访问名为 'var' 的环境变量。

not_match(result, pattern)

url_scheme_authority(url)

url_path(url)

setup_jinja()

match(expected, result, env)

检查 result 是否与 expected 值“相等”。

模块内容

tests.system.openlineage.operator.log[source]
tests.system.openlineage.operator.any(result)[source]
tests.system.openlineage.operator.is_datetime(result)[source]
tests.system.openlineage.operator.is_uuid(result)[source]
tests.system.openlineage.operator.regex_match(result, pattern)[source]
tests.system.openlineage.operator.env_var(var, default=None)[source]

使用此 jinja 方法访问名为 'var' 的环境变量。

如果未设置此类环境变量,则返回默认值。如果默认值为 None,则针对未定义的变量引发异常。

tests.system.openlineage.operator.not_match(result, pattern)[source]
tests.system.openlineage.operator.url_scheme_authority(url)[source]
tests.system.openlineage.operator.url_path(url)[source]
tests.system.openlineage.operator.setup_jinja()[source]
tests.system.openlineage.operator.match(expected, result, env)[source]

检查 result 是否与 expected 值“相等”。

忽略 expected 值中未指定的键,并解析找到的任何 jinja 模板。

class tests.system.openlineage.operator.OpenLineageTestOperator(event_templates=None, file_path=None, env=setup_jinja(), allow_duplicate_events=False, clear_variables=True, **kwargs)[source]

基类: airflow.models.operator.BaseOperator

添加此操作符是为了进行系统测试。

它将初始化时设置的 expected 事件模板与 OpenLineage 集成发出并通过 VariableTransport 存储在 Variables 中的事件模板进行比较。 :param event_templates: 字典,其中 key 是 VariableTransport 使用的格式为 <DAG_ID>.<TASK_ID>.event.<EVENT_TYPE> 的 key,value 是需要在接收到的事件中存在的事件模板(片段)。 :param file_path: 或者,将使用指向包含事件模板的文件的 file_path。 :param env: 用于渲染事件模板的 jinja 环境。 :param allow_duplicate_events: 如果设置为 True,则允许同一 key 存在多个事件。 :param clear_variables: 如果设置为 True,则在检查事件后清除所有 Variables。 :raises: 如果接收到的事件与 expected 事件不匹配,则引发 ValueError。

event_templates = None[source]
file_path = None[source]
env[source]
multiple_events = False[source]
delete = True[source]
execute(context)[source]

创建操作符时派生。

Context 与渲染 jinja 模板时使用的字典相同。

有关更多 context,请参阅 get_template_context。

此条目有帮助吗?