### Install airflow-provider-openfeature Source: https://github.com/1fanwang/airflow-provider-openfeature/blob/main/docs/index.md Standard installation command for the provider package. ```bash pip install airflow-provider-openfeature ``` -------------------------------- ### Initialize development environment Source: https://github.com/1fanwang/airflow-provider-openfeature/blob/main/CONTRIBUTING.md Sets up a virtual environment and installs the package in editable mode with development dependencies. ```bash python -m venv .venv && source .venv/bin/activate pip install -e ".[dev]" ``` -------------------------------- ### Install with uv Source: https://github.com/1fanwang/airflow-provider-openfeature/blob/main/docs/index.md Alternative installation command using the uv package manager. ```bash uv pip install airflow-provider-openfeature ``` -------------------------------- ### Build documentation locally Source: https://github.com/1fanwang/airflow-provider-openfeature/blob/main/README.md Commands to install documentation dependencies and serve the site locally. ```bash pip install -e ".[docs]" mkdocs serve ``` -------------------------------- ### Configure flagd and Start Daemon Source: https://github.com/1fanwang/airflow-provider-openfeature/blob/main/docs/getting-started.md Create a flag configuration file and start the flagd container to serve feature flags to Airflow. ```bash mkdir -p flags && cat > flags/flags.json <<'JSON' { "flags": { "airflow.task.pool": { "state": "ENABLED", "variants": { "canary": "canary_pool", "default": "default_pool" }, "defaultVariant": "default", "targeting": { "if": [ { "in": [ {"var": "dag_id"}, ["etl_alpha", "etl_beta"] ] }, "canary", "default" ] } } } } JSON docker run -d --name flagd -p 8013:8013 -v "$PWD/flags:/flags" \ ghcr.io/open-feature/flagd:latest start --uri file:/flags/flags.json ``` -------------------------------- ### Run development and testing commands Source: https://github.com/1fanwang/airflow-provider-openfeature/blob/main/AGENTS.md Commands for installing dependencies, running unit tests, linting, and executing integration tests. ```bash pip install -e ".[dev]" # editable install with test deps pytest tests/ -q -m "not integration" # unit tests (hermetic) ruff check src tests # lint python -m build && twine check dist/* # package RUN_INTEGRATION=1 pytest tests/integration # real backends (needs docker + an Airflow runtime) ``` -------------------------------- ### Verify Hook and Sensor Source: https://github.com/1fanwang/airflow-provider-openfeature/blob/main/system_tests/E2E.md Example output showing variant retrieval and sensor status via an Airflow connection. ```text hook.get_variant(pool, mig_dag_003): canary_pool hook.get_variant(pool, mig_dag_020): default_pool hook.is_enabled(rollout, mig_dag_003): True FeatureFlagSensor.poke canary: True non-canary: False ``` -------------------------------- ### Run E2E Verification Script Source: https://github.com/1fanwang/airflow-provider-openfeature/blob/main/system_tests/E2E.md Executes the verification script to test example DAGs against a real metadata database and validate documented behaviors. ```bash $ python system_tests/verify_examples_e2e.py [revenue_rollup_example] exit=0 tasks=6 all success: True every region ran v2 with the parity guardrail passing: True [migration_2to3_example] exit=0 tasks=2 all success: True policy moved pool airflow_2x -> airflow_3x: True (pools={'airflow_3x'}) [ab_test_model_example] exit=0 tasks=1 all success: True task picked the flagged model variant: True (model=v2) [openfeature_example] exit=0 tasks=2 all success: True [kubernetes_executor_rollout_example] exit=0 tasks=20 all success: True [executor placement] policy sets task.executor on a regular operator: True [mapped-task safety] executor flag on a mapped task does not break DAG parsing: True [custom dimension] a registered custom placement dimension is applied on a real operator: True 10/10 checks passed ALL EXAMPLE DAGS EXECUTE AND BEHAVE AS DOCUMENTED ``` -------------------------------- ### Define pipeline rollup functions Source: https://github.com/1fanwang/airflow-provider-openfeature/blob/main/docs/case-study/README.md Example implementations of original and optimized rollup functions for data aggregation. ```python def rollup_v1(rows): # original: rescans the shard per (region, date) group keys = {(r["region"], r["order_date"]) for r in rows} return {(region, date): _revenue(rows, region, date) for region, date in keys} def rollup_v2(rows): # rewrite: one pass, dict accumulation out = defaultdict(float) for r in rows: ... return dict(out) ``` -------------------------------- ### Define DAG with Task Source: https://github.com/1fanwang/airflow-provider-openfeature/blob/main/docs/getting-started.md Example DAG definition using EmptyOperator. The task pool assignment is subject to override by the OpenFeature policy. ```python # $AIRFLOW_HOME/dags/etl_alpha.py from airflow import DAG try: from airflow.providers.standard.operators.empty import EmptyOperator # Airflow 3.x except ImportError: from airflow.operators.empty import EmptyOperator # Airflow 2.x import datetime with DAG(dag_id="etl_alpha", schedule=None, start_date=datetime.datetime(2024, 1, 1), catchup=False) as dag: EmptyOperator(task_id="run", pool="default_pool") ``` -------------------------------- ### Define a DAG for dynamic task execution Source: https://github.com/1fanwang/airflow-provider-openfeature/blob/main/README.md Example of a DAG structure that can be controlled by feature flags at parse time using the provider's policy mechanisms. ```python # a large fan-out you would rather move a few at a time (full DAG in example_dags/) with DAG("features_pipeline", schedule=None, start_date=datetime(2024, 1, 1)) as dag: PythonOperator.partial(task_id="process", python_callable=build).expand(op_args=shards) ``` -------------------------------- ### Reproduce the case study rollout Source: https://github.com/1fanwang/airflow-provider-openfeature/blob/main/docs/case-study/README.md Commands to initialize the Unleash environment and execute the ramp-up script. ```bash # 1. bring up Unleash and create the flag docker compose -f system_tests/docker-compose.unleash.yml up -d python system_tests/case_study/setup_unleash_flag.py 50 # creates the flag at a 50% rollout # 2. run the ramp pip install airflow-provider-openfeature UnleashClient PYTHONPATH="src:system_tests/case_study" python system_tests/case_study/run_case_study.py ``` -------------------------------- ### Build and verify package Source: https://github.com/1fanwang/airflow-provider-openfeature/blob/main/PUBLISHING.md Build the package using hatchling and verify metadata with twine. ```bash python -m build # -> dist/airflow_provider_openfeature--py3-none-any.whl + .tar.gz twine check dist/* # metadata + README render check ``` -------------------------------- ### Implement a Custom Backend Provider Source: https://github.com/1fanwang/airflow-provider-openfeature/blob/main/docs/extending.md Create a new backend by inheriting from AbstractProvider. This is only necessary if a backend lacks an existing OpenFeature provider. ```python from openfeature.provider import AbstractProvider from openfeature.provider.metadata import Metadata from openfeature.flag_evaluation import FlagResolutionDetails, Reason class MyBackendProvider(AbstractProvider): def get_metadata(self): return Metadata(name="MyBackendProvider") def get_provider_hooks(self): return [] def resolve_string_details(self, flag_key, default_value, evaluation_context=None): value = my_sdk.evaluate(flag_key, entity=evaluation_context.targeting_key) return FlagResolutionDetails(value=value, variant=value, reason=Reason.TARGETING_MATCH) # boolean / integer / float / object variants likewise ``` -------------------------------- ### Configure GrowthBook provider with warehouse tracking Source: https://github.com/1fanwang/airflow-provider-openfeature/blob/main/docs/measurement.md Initialize the GrowthBook provider with a custom on_track callback to send metrics to your warehouse. ```python from openfeature_airflow.providers.growthbook import GrowthBookProvider def to_warehouse(metric, entity, value, attrs): ... # INSERT into your events table; GrowthBook computes lift from it api.set_provider(GrowthBookProvider(features=..., on_track=to_warehouse)) ``` -------------------------------- ### Run original use cases Source: https://github.com/1fanwang/airflow-provider-openfeature/blob/main/system_tests/E2E.md Executes the four primary use cases for feature gating on a live Airflow instance using flagd. ```bash $ PYTHONPATH="$PWD/src:$PWD/system_tests" python system_tests/run_use_cases.py ============================================================================== Original use cases, gated live on real Airflow via flagd ============================================================================== UC1 2->3 migration 15/30 DAGs on airflow_3x pool, rest airflow_2x ok=True UC2 K8s worker migration 10/30 DAGs on the kubernetes queue ok=True UC3 k8s concurrent pods 5/20 clusters enabled (code-path gate) ok=True UC4 disruption checkpoint 10/30 tasks get resumable checkpointing (gate) ok=True ------------------------------------------------------------------------------ Backend portability of UC1 (2->3 migration routing), same policy, other backends: flagd == GrowthBook == in-house for all 30 DAGs: True ============================================================================== ``` -------------------------------- ### Run multi-backend gating tests Source: https://github.com/1fanwang/airflow-provider-openfeature/blob/main/system_tests/E2E.md Verifies that feature gating logic produces identical results across five different feature flag backends. ```bash $ PYTHONPATH="$PWD/src:$PWD/system_tests" python system_tests/run_all_backends.py [flagd (container)] canary_pool: 10 default_pool: 20 matches expected subset: True [GrowthBook (SDK, local)] canary_pool: 10 default_pool: 20 matches expected subset: True [in-house engine (template)] canary_pool: 10 default_pool: 20 matches expected subset: True [Unleash (container)] canary_pool: 10 default_pool: 20 matches expected subset: True [Statsig (SDK, local mode)] canary_pool: 10 default_pool: 20 matches expected subset: True IDENTICAL-GATING CHECK across 5 live backends: all backends produced identical placement for all 30 DAGs: True ``` -------------------------------- ### Environment Configuration Summary Source: https://github.com/1fanwang/airflow-provider-openfeature/blob/main/system_tests/E2E.md Lists the versions and container configurations for Airflow and various OpenFeature backends used in the E2E tests. ```text apache-airflow 3.2.2 · openfeature-sdk 0.10.0 flagd ghcr.io/open-feature/flagd:latest (container, gRPC + OFREP) · openfeature-provider-flagd 0.5.1 Unleash unleashorg/unleash-server:latest (container + postgres) · UnleashClient 6.8.0 GrowthBook growthbook 2.3.1 (SDK, local eval) Statsig statsig 0.72.0 (SDK, local mode) in-house InHouseTreatmentProvider (in-process template) ``` -------------------------------- ### Run pre-submission checks Source: https://github.com/1fanwang/airflow-provider-openfeature/blob/main/CONTRIBUTING.md Executes unit tests, linting, and package build verification. All commands must pass before opening a pull request. ```bash pytest tests/ -q -m "not integration" # unit tests, hermetic ruff check src tests # lint python -m build && twine check dist/* # package builds and is well-formed ``` -------------------------------- ### Run integration tests Source: https://github.com/1fanwang/airflow-provider-openfeature/blob/main/CONTRIBUTING.md Executes integration tests against real backends. Requires Docker and an Airflow runtime. ```bash RUN_INTEGRATION=1 pytest tests/integration -m integration ``` -------------------------------- ### Verify Live Task Pool Switching Source: https://github.com/1fanwang/airflow-provider-openfeature/blob/main/system_tests/E2E.md Demonstrates the transition of an Airflow task execution pool following a live configuration change in the flagd daemon. ```text === REAL TASK RUN #1 (flagd: dag_003 in the migration subset) === TaskInstance dag_003.only ran with pool = 'airflow_3x' state = 'success' ...edited the flag config flagd watches: drop dag_003 from the subset; flagd hot-reloads... === REAL TASK RUN #2 (flagd live-changed: dag_003 no longer in subset) === TaskInstance dag_003.only NOW ran with pool = 'airflow_2x' state = 'success' ``` -------------------------------- ### Execute Performance Measurement Loop Source: https://github.com/1fanwang/airflow-provider-openfeature/blob/main/system_tests/E2E.md Command to run the system measurement loop and the resulting performance output for different backends. ```bash $ PYTHONPATH="$PWD/src:$PWD/system_tests" python system_tests/measure_loop.py [flagd (gRPC container)] readout: no native analytics -> OTEL/StatsD warehouse (openfeature.outcome.* metric) group runs mean ms median ms control 8 69.2 70.2 fastpath 8 22.4 23.0 -> fastpath 67.7% faster (measured) [Statsig (server SDK, real log_event)] readout: 16 events -> sg.log_event (Pulse/metrics in a hosted project) group runs mean ms median ms control 8 74.1 69.1 fastpath 8 21.7 21.5 -> fastpath 70.7% faster (measured) [in-house engine (template)] readout: 16 outcomes -> provider.tracked (warehouse export) control 67.8 ms vs fastpath 23.2 ms -> 65.8% faster (measured) readout proven for: ['flagd', 'statsig', 'in-house'] ``` -------------------------------- ### Manual upload to PyPI Source: https://github.com/1fanwang/airflow-provider-openfeature/blob/main/PUBLISHING.md Commands for manually uploading to TestPyPI for verification before the final production release. ```bash twine upload --repository testpypi dist/* pip install -i https://test.pypi.org/simple/ airflow-provider-openfeature # smoke test twine upload dist/* # real PyPI ``` -------------------------------- ### Configure flagd targeting for ramp-up Source: https://github.com/1fanwang/airflow-provider-openfeature/blob/main/docs/getting-started.md Use the fractional operator in the flag file to define percentage-based targeting for DAG pools. ```bash # add more DAGs to the "in" list, or switch to a percentage with flagd's fractional operator: # "targeting": { "fractional": [ ["canary", 25], ["default", 75] ] } ``` -------------------------------- ### Enable OpenFeature Policy Source: https://github.com/1fanwang/airflow-provider-openfeature/blob/main/docs/getting-started.md Set the environment variable to enable the placement policy, which is disabled by default. ```bash export AIRFLOW__OPENFEATURE__ENABLE_POLICY=True ``` -------------------------------- ### Enable OpenFeature Features Source: https://github.com/1fanwang/airflow-provider-openfeature/blob/main/README.md Enable policy-driven placement and exposure tracking in the Airflow configuration. ```ini [openfeature] enable_policy = True # flag-driven pool/queue/executor placement enable_exposure_listener = True # record which group each run landed in ``` -------------------------------- ### Run KubernetesExecutor Canary E2E Test Source: https://github.com/1fanwang/airflow-provider-openfeature/blob/main/system_tests/E2E.md Execute the canary test script with the appropriate PYTHONPATH to verify task routing and pod creation. ```bash $ PYTHONPATH="$PWD/src:$PWD/system_tests" python system_tests/k8s_canary_e2e.py [ramp 25%] flag routes 2/12 DAGs to kubernetes: ['etl_dag_02', 'etl_dag_10'] real pods on the cluster: 2 states={'etl_dag_02': 'Running', 'etl_dag_10': 'Running'} [ramp 50% (ramped live via flagd hot-reload)] flag routes 7/12 DAGs to kubernetes: ['etl_dag_02', 'etl_dag_06', 'etl_dag_07', 'etl_dag_08', 'etl_dag_09', 'etl_dag_10', 'etl_dag_11'] real pods on the cluster: 7 states={'etl_dag_02':'Succeeded', 'etl_dag_06':'Running', ...} subset grew 2 -> 7 and every routed task ran as a real pod: True ``` -------------------------------- ### Tag and trigger release Source: https://github.com/1fanwang/airflow-provider-openfeature/blob/main/PUBLISHING.md Create a git tag to trigger the GitHub Action workflow for automated PyPI publishing. ```bash git tag v0.1.0 && git push origin v0.1.0 # triggers .github/workflows/publish.yml ``` -------------------------------- ### Configure StatsD metrics for warehouse readout Source: https://github.com/1fanwang/airflow-provider-openfeature/blob/main/docs/measurement.md Enable StatsD and Datadog tags in the configuration to export metrics for dashboarding. ```ini [metrics] statsd_on = True statsd_datadog_enabled = True # emits the variant/dag_id tags ``` -------------------------------- ### Execute and Verify DAG Source: https://github.com/1fanwang/airflow-provider-openfeature/blob/main/docs/getting-started.md Commands to trigger a DAG test run and inspect the resulting task states in the metadata database. ```bash airflow dags test etl_alpha ``` ```bash airflow tasks states-for-dag-run etl_alpha # pool column shows canary_pool ``` -------------------------------- ### Run Unit Tests Source: https://github.com/1fanwang/airflow-provider-openfeature/blob/main/system_tests/E2E.md Command to execute the test suite using pytest. ```bash $ pytest tests/ -q 14 passed ``` -------------------------------- ### Configure OpenFeature Provider Source: https://github.com/1fanwang/airflow-provider-openfeature/blob/main/README.md Set the OpenFeature provider in airflow_local_settings.py or a bootstrap script. ```python from openfeature import api from openfeature.contrib.provider.flagd import FlagdProvider api.set_provider(FlagdProvider(host="localhost", port=8013)) ``` -------------------------------- ### Track outcomes with LaunchDarkly Source: https://github.com/1fanwang/airflow-provider-openfeature/blob/main/docs/measurement.md Use the LaunchDarkly client directly to track metrics when the OpenFeature provider does not forward track calls. ```python import ldclient ldclient.get().track("task_duration_ms", ld_context, metric_value=elapsed_ms) ``` -------------------------------- ### Migrate tasks to Kubernetes queue with percentage ramp Source: https://github.com/1fanwang/airflow-provider-openfeature/blob/main/docs/use-cases.md Applies a fractional operator to deterministically distribute tasks between Kubernetes and Celery queues. ```json { "flags": { "airflow.task.queue": { "state": "ENABLED", "variants": { "k8s": "kubernetes", "celery": "default" }, "defaultVariant": "celery", "targeting": { "fractional": [ ["k8s", 20], ["celery", 80] ] } } } } ``` -------------------------------- ### Implement Canary Logic in Airflow DAG Source: https://github.com/1fanwang/airflow-provider-openfeature/blob/main/README.md Use flag_enabled to determine which implementation to run and track_outcome to record performance metrics for the chosen variant. ```python from openfeature_airflow.gate import flag_enabled from openfeature_airflow.measure import track_outcome use_v2 = flag_enabled("revenue_rollup.use_fast_agg", region) # the backend decides the subset result = (rollup_v2 if use_v2 else rollup_v1)(shard) # run the chosen implementation track_outcome("rollup_ms", region, value=elapsed_ms, variant="v2" if use_v2 else "v1") ``` -------------------------------- ### Implement a kill switch for DAG pools Source: https://github.com/1fanwang/airflow-provider-openfeature/blob/main/docs/getting-started.md Empty the targeting subset to revert all DAGs to the default pool without requiring a code deployment. ```json "targeting": { "if": [ { "in": [ {"var": "dag_id"}, [] ] }, "canary", "default" ] } ``` -------------------------------- ### Implement feature flag gating and tracking Source: https://github.com/1fanwang/airflow-provider-openfeature/blob/main/docs/case-study/README.md Logic to check feature flag status and record outcomes for pipeline measurement. ```python from openfeature_airflow.gate import flag_enabled from openfeature_airflow.measure import track_outcome use_v2 = flag_enabled("revenue_rollup.use_fast_agg", region, region=region) result = (rollup_v2 if use_v2 else rollup_v1)(shard) track_outcome("rollup_ms", region, value=elapsed_ms, variant="v2" if use_v2 else "v1", region=region) ``` -------------------------------- ### Register Flagd Provider Source: https://github.com/1fanwang/airflow-provider-openfeature/blob/main/docs/getting-started.md Configure the OpenFeature backend in airflow_local_settings.py. The sleep call ensures the gRPC resolver has sufficient time to establish a connection. ```python import time from openfeature import api from openfeature.contrib.provider.flagd import FlagdProvider api.set_provider(FlagdProvider(host="localhost", port=8013)) time.sleep(1) # the gRPC resolver needs a moment to connect ``` -------------------------------- ### Register Custom Placement Dimensions Source: https://github.com/1fanwang/airflow-provider-openfeature/blob/main/docs/extending.md Use register_placement to map flag values to task attributes. Setters that raise exceptions are ignored to prevent DAG parsing failures. ```python # in airflow_local_settings.py or a bootstrap from openfeature_airflow.policy import register_placement # a string dimension: set an operator attribute from the flag's value register_placement("airflow.task.spark_version", lambda t, v: setattr(t, "spark_version", v)) # a boolean, expressed as a "true"/"false" variant the setter coerces register_placement("airflow.task.enable_checkpoint", lambda t, v: setattr(t, "enable_checkpoint", v == "true")) # a number dimension reads an integer flag register_placement("airflow.task.retries", lambda t, v: setattr(t, "retries", v), kind="number") ``` -------------------------------- ### Canary test a KubernetesExecutor change Source: https://github.com/1fanwang/airflow-provider-openfeature/blob/main/docs/use-cases.md Routes specific DAGs to a canary KubernetesExecutor variant to test concurrent pod creation features. ```json { "flags": { "airflow.task.executor": { "state": "ENABLED", "variants": { "canary": "KubernetesExecutorCanary", "default": "" }, "defaultVariant": "default", "targeting": { "if": [ { "in": [ { "var": "dag_id" }, ["etl_alpha"] ] }, "canary", "default" ] } } } } ``` -------------------------------- ### Evaluate flags via OFREP HTTP API Source: https://github.com/1fanwang/airflow-provider-openfeature/blob/main/system_tests/E2E.md Demonstrates how to query the flagd OFREP endpoint to evaluate the airflow.task.pool flag based on specific DAG context. ```bash $ curl -s -X POST localhost:8116/ofrep/v1/evaluate/flags/airflow.task.pool -d '{"context":{"dag_id":"dag_003"}}' {"value": "airflow_3x", "key": "airflow.task.pool", "reason": "TARGETING_MATCH", "variant": "v3x", "metadata": {}} $ curl ... -d '{"context":{"dag_id":"dag_020"}}' {"value": "airflow_2x", "key": "airflow.task.pool", "reason": "TARGETING_MATCH", "variant": "v2x", "metadata": {}} ``` -------------------------------- ### Verify namespace integrity Source: https://github.com/1fanwang/airflow-provider-openfeature/blob/main/PUBLISHING.md Ensure the wheel does not contain the airflow namespace to prevent clobbering. ```bash python -c "import zipfile,glob; z=zipfile.ZipFile(sorted(glob.glob('dist/*.whl'))[-1]); \ assert not any(n.startswith('airflow/') for n in z.namelist()), 'ships airflow/ namespace!'; print('ok')" ``` -------------------------------- ### Capture outcomes with PostHog Source: https://github.com/1fanwang/airflow-provider-openfeature/blob/main/docs/measurement.md Use the PostHog capture method to record experiment outcomes as product analytics events. ```python posthog.capture(distinct_id=entity, event="task_duration_ms", properties={"variant": group, "value": elapsed_ms}) ``` -------------------------------- ### A/B test a model or algorithm Source: https://github.com/1fanwang/airflow-provider-openfeature/blob/main/docs/use-cases.md Uses the variant function to split execution paths based on a flag key. Requires the flag to be configured as a weighted variant in the OpenFeature provider. ```python from openfeature_airflow.gate import variant def choose_model(**context): entity = context["dag"].dag_id return variant("ranking.model_version", entity, default="v1") # "v1" or "v2" per the split ``` -------------------------------- ### Wait for a rollout with FeatureFlagSensor Source: https://github.com/1fanwang/airflow-provider-openfeature/blob/main/docs/use-cases.md Blocks downstream task execution until a specific feature flag is enabled. Requires a valid connection ID to the OpenFeature provider. ```python from openfeature_airflow.sensors.feature_flag import FeatureFlagSensor wait = FeatureFlagSensor(task_id="wait_for_rollout", flag_key="feature.new_path", conn_id="openfeature") ``` -------------------------------- ### Track experiment outcomes with OpenFeature Source: https://github.com/1fanwang/airflow-provider-openfeature/blob/main/docs/measurement.md Use track_outcome within an Airflow task to record experiment metrics after work is completed. ```python from openfeature_airflow.measure import track_outcome # in your task, after the work is done: track_outcome("task_duration_ms", f"{dag_id}:{task_id}", value=elapsed_ms, variant=group, dag_id=dag_id) ``` -------------------------------- ### Record task outcomes for analysis Source: https://github.com/1fanwang/airflow-provider-openfeature/blob/main/README.md Use the track_outcome function to send metrics or experiment results to configured backends. ```python from openfeature_airflow.measure import track_outcome track_outcome("task_duration_ms", f"{dag_id}:{task_id}", value=elapsed_ms, variant=group) ``` -------------------------------- ### Migrate DAGs between Airflow worker pools Source: https://github.com/1fanwang/airflow-provider-openfeature/blob/main/docs/use-cases.md Uses a targeting rule to route specific DAG IDs to an Airflow 3.x worker pool while defaulting others to 2.x. ```json { "flags": { "airflow.task.pool": { "state": "ENABLED", "variants": { "v3": "airflow_3x", "v2": "airflow_2x" }, "defaultVariant": "v2", "targeting": { "if": [ { "in": [ { "var": "dag_id" }, ["etl_alpha", "etl_beta"] ] }, "v3", "v2" ] } } } } ``` -------------------------------- ### Evaluate a feature flag in Airflow Source: https://github.com/1fanwang/airflow-provider-openfeature/blob/main/README.md Use the flag_enabled function to conditionally execute logic within an Airflow task based on a feature flag. ```python from openfeature_airflow.gate import flag_enabled if flag_enabled("airflow.rollout.new_parser", dag_id): ... ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.