text stringlengths 79 3.72M |
|---|
<vulnerable_code>from airflow.utils.helpers import validate_key
from airflow.utils.operator_resources import Resources
from airflow.utils.session import NEW_SESSION, provide_session
from airflow.utils.trigger_rule import TriggerRule
from airflow.utils.weight_rule import WeightRule
)
self.templa... |
<vulnerable_code> @contextmanager
def setup(cls):
if cls.is_setup or cls.is_teardown:
raise AirflowException(
"A setup task or taskgroup cannot be nested inside another setup/teardown task or taskgroup"
)
cls.is_setup = True
try:
@contextmanage... |
<vulnerable_code> ui_color: str = "CornflowerBlue",
ui_fgcolor: str = "#000",
add_suffix_on_collision: bool = False,
setup: bool = False,
teardown: bool = False,
on_failure_fail_dagrun: bool = False,
):
from airflow.models.dag import DagContext
if setu... |
<vulnerable_code>
from airflow import AirflowException
from airflow.decorators import setup, task, task_group, teardown
from airflow.models.baseoperator import BaseOperator
from airflow.operators.bash import BashOperator
from airflow.utils.task_group import TaskGroup
class TestSetupTearDownTask:
assert setup_... |
<vulnerable_code> assert task._is_setup == is_setup
assert task._is_teardown == is_teardown
def test_task_group_setup_teardown_tasks(self):
"""
Test TaskGroup setup and teardown task serialization/deserialization.
"""
execution_date = datetime(2020, 1, 1)
... |
<vulnerable_code> with SetupTeardownContext.setup():
with pytest.raises(
AirflowException,
match=(
"A setup task or taskgroup cannot be nested inside another"
" setup/teardown task or taskgroup"
),
):
... |
<vulnerable_code> account from the list granting this role to the originating account (templated).
:param labels: a dictionary containing labels for the table, passed to BigQuery
:param deferrable: Run operator in the deferrable mode
"""
template_fields: Sequence[str] = (
impersonation_c... |
<vulnerable_code> is_flag=True,
envvar="FULL_TESTS_NEEDED",
)
@option_verbose
@option_dry_run
@click.argument("extra_pytest_args", nargs=-1, type=click.UNPROCESSED)
full_tests_needed: bool,
mount_sources: str,
extra_pytest_args: tuple,
):
docker_filesystem = get_filesystem_type("/var/lib/docker")... |
<vulnerable_code> "options": [
"--image-tag",
"--mount-sources",
],
},
],<commit_title>[PATCH 001/147] Add gitSync optional env description (#29378)<commit_description><fixed_code>
"options": [
"--image-tag",
... |
<vulnerable_code> version_suffix_for_pypi: str = ""
dry_run: bool = False
verbose: bool = False
def clone_with_test(self, test_type: str) -> ShellParams:
new_params = deepcopy(self)<commit_title>[PATCH 001/147] Add gitSync optional env description (#29378)<commit_description><fixed_code>
ver... |
<vulnerable_code> set_value_to_default_if_not_set(env, "SKIP_SSH_SETUP", "false")
set_value_to_default_if_not_set(env, "TEST_TYPE", "")
set_value_to_default_if_not_set(env, "TEST_TIMEOUT", "60")
set_value_to_default_if_not_set(env, "UPGRADE_TO_NEWER_DEPENDENCIES", "false")
set_value_to_default_if_not... |
<vulnerable_code> r"\.py$",
],
FileGroupForCi.ALL_SOURCE_FILES: [
"^.pre-commit-config.yaml$",
"^airflow",
"^chart",
"^tests",
"^kubernetes_tests",
],
FileGroupForCi.SYSTEM_TEST_FILES: [
"^tests/system/",
... |
<vulnerable_code> "image-build": "false",
"needs-helm-tests": "false",
"run-tests": "false",
"docs-build": "false",
"upgrade-to-newer-dependencies": "false",
"test-types": "",
"imag... |
<vulnerable_code>from airflow.providers.amazon.aws.hooks.base_aws import AwsBaseAsyncHook
from tests.providers.amazon.aws.utils.compat import async_mock
try:
from aiobotocore.credentials import AioCredentials
except ImportError:<commit_title>[PATCH 001/147] Add gitSync optional env description (#29378)<commit_desc... |
<vulnerable_code>from airflow.triggers.base import TriggerEvent
from tests.providers.amazon.aws.utils.compat import async_mock
TASK_ID = "redshift_trigger_check"
POLLING_PERIOD_SECONDS = 1.0
<commit_title>[PATCH 001/147] Add gitSync optional env description (#29378)<commit_description><fixed_code>
from airflow.trigger... |
<vulnerable_code> :param async_mode: whether to start the manager in async mode
"""
def __init__(
self,
dag_directory: os.PathLike,
async_mode: bool = True,
):
super().__init__()
self._file_paths: list[str] = []
self._file_path_queue: collections.deque[str... |
<vulnerable_code> msg=None,
)
# when
manager._add_callback_to_queue(dag1_req1)
manager._add_callback_to_queue(dag1_sla1)
# when
manager._add_callback_to_queue(dag1_sla2)
# then - since sla2 == sla1, should not have brought dag1 to the fore
as... |
<vulnerable_code>
import dataclasses
import enum
import logging
import re
import sys
import airflow.serialization.serializers
from airflow.configuration import conf
from airflow.utils.module_loading import import_string, iter_namespace, qualname
log = logging.getLogger(__name__)
_primitives = (int, bool, float, str)... |
<vulnerable_code># under the License.
from __future__ import annotations
from decimal import Decimal
from typing import TYPE_CHECKING
from airflow.utils.module_loading import qualname
if TYPE_CHECKING:
from airflow.serialization.serde import U
serializers = [Decimal]
deserializers = serializers
__version__ = ... |
<vulnerable_code># under the License.
from __future__ import annotations
from datetime import date, datetime, timedelta
from typing import TYPE_CHECKING
from pendulum import DateTime
from pendulum.tz import timezone
from airflow.utils.module_loading import qualname
from airflow.utils.timezone import convert_to_utc, ... |
<vulnerable_code>
from airflow.utils.module_loading import qualname
serializers = []
try:
from kubernetes.client import models as k8s
serializers = [k8s.v1_pod.V1Pod, k8s.V1ResourceRequirements]
except ImportError:
k8s = None
if TYPE_CHECKING:
from airflow.serialization.serde import U
__version__ ... |
<vulnerable_code>
from typing import TYPE_CHECKING, Any
from airflow.utils.module_loading import qualname
serializers = []
try:
import numpy as np
serializers = [
np.int_,
np.intc,
np.intp,
np.int8,
np.int16,
np.int32,
np.int64,
np.uint8,
... |
<vulnerable_code>
from typing import TYPE_CHECKING
import pendulum
from pendulum.tz.timezone import FixedTimezone, Timezone
from airflow.utils.module_loading import qualname
if TYPE_CHECKING:
from airflow.serialization.serde import U
serializers = [FixedTimezone, Timezone]
deserializers = serializers
__versio... |
<vulnerable_code>import datetime
import enum
from dataclasses import dataclass
from typing import ClassVar
import attr
DATA,
SCHEMA_ID,
VERSION,
_compile_patterns,
_match,
deserialize,
serialize,
)
from airflow.utils.module_loading import qualname
from tests.test_utils.config import conf_va... |
<vulnerable_code>import time
import warnings
from collections import deque
from copy import copy
from queue import SimpleQueue
from typing import TYPE_CHECKING, Deque
# CancelledError will get injected when we're stopped - which is
# fine, the cleanup process will understand that, but we want to... |
<vulnerable_code> raise NotImplementedError("Triggers must implement run()")
yield # To convince Mypy this is an async iterator.
def cleanup(self) -> None:
"""
Cleanup the trigger.
Called when the trigger is no longer needed, and it's being removed
from the active t... |
<vulnerable_code> from airflow.models import DagRun
class AirflowTermSignal(Exception):
"""Raise when we receive a TERM signal"""
status_code = HTTPStatus.INTERNAL_SERVER_ERROR
class AirflowException(Exception):
"""
Base class for all Airflow's errors.<commit_title>[PATCH 001/147] Add gitSync op... |
<vulnerable_code> AirflowSensorTimeout,
AirflowSkipException,
AirflowTaskTimeout,
AirflowTermSignal,
DagRunNotFound,
RemovedInAirflow3Warning,
TaskDeferralError,
os._exit(1)
return
self.log.error("Received SIGTERM. Terminating subprocesses.")
... |
<vulnerable_code> ti.run()
assert State.SKIPPED == ti.state
def test_task_sigterm_works_with_retries(self, dag_maker):
"""
Test that ensures that tasks are retried when they receive sigterm
"""
def task_function(ti):
os.kill(ti.pid, signal.SIGTERM)
... |
<vulnerable_code> FAILED = "Failed"
CANCELING = "Canceling"
CANCELLED = "Cancelled"
TERMINAL_STATUSES = {CANCELLED, FAILED, SUCCEEDED}
class AzureDataFactoryPipelineRunException(AirflowException):<commit_title>[PATCH 001/147] Add gitSync optional env description (#29378)<commit_description><fixed_code... |
<vulnerable_code># under the License.
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Sequence
from airflow.hooks.base import BaseHook
from airflow.models import BaseOperator, BaseOperatorLink, XCom
from airflow.providers.microsoft.azure.hooks.data_factory import (
AzureDataFactoryPipeli... |
<vulnerable_code>from __future__ import annotations
import asyncio
from typing import Any, AsyncIterator
from airflow.providers.microsoft.azure.hooks.data_factory import (
await asyncio.sleep(self.poke_interval)
except Exception as e:
yield TriggerEvent({"status": "error", "message... |
<vulnerable_code>from __future__ import annotations
import json
from unittest.mock import MagicMock, patch
import pytest
from airflow.models import Connection
from airflow.providers.microsoft.azure.hooks.data_factory import (
AzureDataFactoryHook,
AzureDataFactoryPipelineRunException,
AzureDataFactoryPip... |
<vulnerable_code>
from airflow.providers.microsoft.azure.triggers.data_factory import (
ADFPipelineRunStatusSensorTrigger,
)
from airflow.triggers.base import TriggerEvent
task = [i async for i in self.TRIGGER.run()]
assert len(task) == 1
assert TriggerEvent({"status": "error", "message": "... |
<vulnerable_code> )
# [END howto_operator_adf_run_pipeline_async]
begin >> Label("No async wait") >> run_pipeline1
begin >> Label("Do async wait with sensor") >> run_pipeline2
[run_pipeline1, pipeline_run_sensor, pipeline_run_async_sensor] >> end
# Task dependency created via `XComArgs`:<commit... |
<vulnerable_code>
DEFAULT_EXTRAS = [
# BEGINNING OF EXTRAS LIST UPDATED BY PRE COMMIT
"amazon",
"async",
"celery",<commit_title>[PATCH 001/147] Add gitSync optional env description (#29378)<commit_description><fixed_code>
DEFAULT_EXTRAS = [
# BEGINNING OF EXTRAS LIST UPDATED BY PRE COMMIT
"aiob... |
<vulnerable_code> "wheel",
"yamllint",
"aioresponses",
# This required for AWS deferrable operators.
# There is conflict between boto3 and aiobotocore dependency botocore.
# TODO: We can remove it once boto3 and aiobotocore both have compatible botocore version or
devel = get_unique_dependency_l... |
<vulnerable_code> extra_args["sqlite_warning"] = settings.engine.dialect.name == "sqlite"
if not executor.is_production:
extra_args["production_executor_warning"] = executor.__name__
line_chart_attr = {
"legend.maxKeyLength": 200,<commit_title>[PATCH 001/147] Add gitSync optional... |
<vulnerable_code> "python-ldap",
]
leveldb = ["plyvel"]
pandas = [
"pandas>=0.17.1",
]
# Mypy 0.900 and above ships only with stubs from stdlib so if we need other stubs, we need to install them
# manually as `types-*`. See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
# for details. W... |
<vulnerable_code>from __future__ import annotations
import copy
import unittest
from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
from google.api_core.retry import Retry
self.config = config
class TestGoogleCloudBaseOperator(unittest.TestCase):
def test_handles_deepcopy_with_method_def... |
<vulnerable_code>from sqlalchemy.orm import Session
from airflow.api_connexion import security
from airflow.api_connexion.exceptions import AlreadyExists, BadRequest, NotFound
from airflow.api_connexion.parameters import apply_sorting, check_limit, format_parameters
from airflow.api_connexion.schemas.connection_schema... |
<vulnerable_code><commit_title>[PATCH 001/147] Add gitSync optional env description (#29378)<commit_description><fixed_code>
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding cop... |
<vulnerable_code>
from airflow.api_connexion import security
from airflow.api_connexion.endpoints.request_dict import get_json_request_dict
from airflow.api_connexion.exceptions import BadRequest, NotFound
from airflow.api_connexion.parameters import apply_sorting, check_limit, format_parameters
from airflow.api_connex... |
<vulnerable_code><commit_title>[PATCH 001/147] Add gitSync optional env description (#29378)<commit_description><fixed_code>
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding cop... |
<vulnerable_code> environ_overrides={"REMOTE_USER": "test"},
)
assert response.status_code == 200
assert response.json == {
"key": "var1",
"value": "updated",
}
_check_last_log(session, dag_id=None, event="variable.edit", execution_date=None)
... |
<vulnerable_code>import requests
import semver
import yaml
ROOT_DIR = Path(__file__).resolve().parent / ".."
KNOWN_FALSE_DETECTIONS = {
# This option has been added in v2.0.0, but we had mistake in config.yml file until v2.2.0.
# https://github.com/apache/airflow/pull/17808
("logging", "extra_logger_names... |
<vulnerable_code>
return hook.insert_job(
configuration=configuration,
project_id=hook.project_id,
location=self.location,
job_id=job_id,
timeout=self.result_timeout,<commit_title>[PATCH 001/147] Add gitSync optional env description (#29378)<commit_des... |
<vulnerable_code> job_id: str | None = None,
force_rerun: bool = True,
reattach_states: set[str] | None = None,
**kwargs,
) -> None:
# BQ config
self.destination_project_dataset_table = destination_project_dataset_table
self.schema_fields = schema_fields
... |
<vulnerable_code> job_id=pytest.real_job_id,
location=None,
nowait=True,
project_id=hook.return_value.project_id,
retry=DEFAULT_RETRY,
timeout=None,
),
job_id=pytest.real_job_id,
lo... |
<vulnerable_code><commit_title>[PATCH 001/147] Add gitSync optional env description (#29378)<commit_description><fixed_code>
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding cop... |
<vulnerable_code># under the License.
from __future__ import annotations
import os
import subprocess
import sys
import tempfile
import time
from unittest import mock
import psutil
import pytest
from airflow import settings
from airflow.cli import cli_parser
from airflow.cli.commands import internal_api_command
from ... |
<vulnerable_code>import sys
import tempfile
import time
from unittest import mock
import psutil
import pytest
from airflow import settings
from airflow.cli import cli_parser
from airflow.cli.commands import webserver_command
from airflow.cli.commands.webserver_command import GunicornMonitor
from airflow.utils.cli imp... |
<vulnerable_code> # then have a copy of the app
run_args += ["--preload"]
gunicorn_master_proc = None
def kill_proc(signum, _):
log.info("Received signal: %s. Closing gunicorn.", signum)
gunicorn_master_proc.terminate()
with suppress(TimeoutError):
... |
<vulnerable_code>
import pytest
from aiohttp import ClientResponseError, RequestInfo
from gcloud.aio.bigquery import Table
from multidict import CIMultiDict
from yarl import URL
TEST_CONN_ID = "bq_default"
TEST_JOB_ID = "1234"
RUN_ID = "1"
RETRY_LIMIT = 2
RETRY_DELAY = 1.0
TEST_GCP_PROJECT_ID = "test-project"
TEST_DA... |
<vulnerable_code>
import asyncio
import logging
import sys
import pytest
from google.cloud.bigquery_datatransfer_v1 import TransferState
from airflow.providers.google.cloud.triggers.bigquery_dts import BigQueryDataTransferRunTrigger
from airflow.triggers.base import TriggerEvent
if sys.version_info < (3, 8):
fro... |
<vulnerable_code>
import asyncio
import logging
import sys
import pytest
from airflow.providers.google.cloud.triggers.datafusion import DataFusionStartPipelineTrigger
from airflow.triggers.base import TriggerEvent
if sys.version_info < (3, 8):
from asynctest import mock
else:
from unittest import mock
HOOK_... |
<vulnerable_code> super().__init__(http_conn_id=livy_conn_id)
self.extra_headers = extra_headers or {}
self.extra_options = extra_options or {}
self.auth_type = auth_type or self.auth_type
def get_conn(self, headers: dict[str, Any] | None = None) -> Any:
"""<commit_title>[PAT... |
<vulnerable_code> :param tcp_keep_alive_count: The TCP Keep Alive count parameter (corresponds to ``socket.TCP_KEEPCNT``)
:param tcp_keep_alive_interval: The TCP Keep Alive interval parameter (corresponds to
``socket.TCP_KEEPINTVL``)
"""
conn_name_attr = "http_conn_id"
self,
meth... |
<vulnerable_code>
from typing import TYPE_CHECKING, Any, Callable, Sequence
from requests.auth import AuthBase, HTTPBasicAuth
from airflow.exceptions import AirflowException
from airflow.models import BaseOperator
extra_options: dict[str, Any] | None = None,
http_conn_id: str = "http_default",
... |
<vulnerable_code># under the License.
from __future__ import annotations
import json
import logging
import os
import tenacity
from aioresponses import aioresponses
from requests.adapters import Response
from airflow.exceptions import AirflowException
from airflow.models import Connection
return Connection(conn_id... |
<vulnerable_code> uri: str = attr.field(validator=[attr.validators.min_len(1), attr.validators.max_len(3000)])
extra: dict[str, Any] | None = None
version: ClassVar[int] = 1
@uri.validator
def _check_uri(self, attr, uri: str):<commit_title>[PATCH 001/147] Add gitSync optional env description (#2937... |
<vulnerable_code>
_serializers: dict[str, ModuleType] = {}
_deserializers: dict[str, ModuleType] = {}
_extra_allowed: set[str] = set()
_primitives = (int, bool, float, str)
return {CLASSNAME: cls, VERSION: version, DATA: data}
def decode(d: dict[str, str | int | T]) -> tuple:
return d[CLASSNAME], d[VERSION],... |
<vulnerable_code> if isinstance(o, dict) and (CLASSNAME in o or SCHEMA_ID in o):
raise AttributeError(f"reserved key {CLASSNAME} found in dict to serialize")
return super().encode(o)
<commit_title>[PATCH 001/147] Add gitSync optional env description (#29378)<commit_description><fixed_code>
... |
<vulnerable_code> ti = dr.get_task_instances()[0]
assert res.operator.multiple_outputs is False
assert ti.xcom_pull() == [8, 4]
assert ti.xcom_pull(key="return_value_0") is None
assert ti.xcom_pull(key="return_value_1") is None
ti = dr.get_task_instances()[0]
as... |
<vulnerable_code> x: int
@pytest.mark.usefixtures("recalculate_patterns")
class TestSerDe:
def test_ser_primitives(self):
e = serialize(i)
assert i == e
def test_ser_iterables(self):
i = [1, 2]
e = serialize(i)
assert i == e
i = ("a", "b", "a", "c")
... |
<vulnerable_code> s = json.dumps(u, cls=utils_json.XComEncoder)
o = json.loads(s, cls=utils_json.XComDecoder, object_hook=utils_json.XComDecoder.orm_object_hook)
assert o == f"{U.__module__}.{U.__qualname__}@version={U.__version__}(x={x})"<commit_title>[PATCH 001/147] Add gitSync optional env des... |
<vulnerable_code> image_prefix = "Amazon Linux*"
images = boto3.client("ec2").describe_images(
Filters=[{"Name": "description", "Values": [image_prefix]}], Owners=["amazon"]
)
# Sort on CreationDate
sorted_images = sorted(images["Images"], key=itemgetter("CreationDate"), reverse=True)
im... |
<vulnerable_code> "2.0.0",
),
("logging", "task_log_reader"): ("core", "task_log_reader", "2.0.0"),
("metrics", "statsd_on"): ("scheduler", "statsd_on", "2.0.0"),
("metrics", "statsd_host"): ("scheduler", "statsd_host", "2.0.0"),
("metrics", "statsd_port"): ("scheduler... |
<vulnerable_code> port=conf.getint("metrics", "statsd_port"),
prefix=conf.get("metrics", "statsd_prefix"),
)
if conf.get("metrics", "statsd_allow_list", fallback=None):
metrics_validator = AllowListValidator(conf.get("metrics", "statsd_allow_list"))
if conf... |
<vulnerable_code> with conf_vars(
{
("metrics", "statsd_on"): "True",
("metrics", "statsd_allow_list"): "name1,name2",
}
):
importlib.reload(airflow.stats)
with conf_vars(
{
("metrics", "statsd_on"): "... |
<vulnerable_code>import textwrap
import warnings
from datetime import datetime, timedelta
from typing import TYPE_CHECKING, Callable, Sequence
from google.api_core.retry import Retry
from google.cloud.storage.retry import DEFAULT_RETRY
delegate_to: str | None = None,
impersonation_chain: str | Sequence... |
<vulnerable_code> )
mock_hook.return_value.exists.assert_called_once_with(TEST_BUCKET, TEST_OBJECT, DEFAULT_RETRY)
class TestGoogleCloudStorageObjectSensorAsync:
def test_gcs_object_existence_sensor_async(self):
"""
Asserts that a task is deferred and a GCSBlobTrigger will be fired
... |
<vulnerable_code> )
# [END howto_sensor_object_exists_task_async]
# [START howto_sensor_object_with_prefix_exists_task]
gcs_object_with_prefix_exists = GCSObjectsWithPrefixExistenceSensor(
bucket=BUCKET_NAME,
sleep,
upload_file,
# TEST BODY
[gcs_object_exists, gcs... |
<vulnerable_code>import sys
import textwrap
import time
from contextlib import suppress
from time import sleep
from typing import NoReturn
# then have a copy of the app
run_args += ["--preload"]
gunicorn_master_proc: psutil.Process | None = None
def kill_proc(signum, _):
lo... |
<vulnerable_code> self.bag_dag(dag=dag, root_dag=dag)
except Exception as e:
self.log.exception("Failed to bag_dag: %s", dag.fileloc)
self.import_errors[dag.fileloc] = str(e)
self.file_last_changed[dag.fileloc] = file_last_changed_on_disk
... |
<vulnerable_code>
found_2 = dagbag.process_file(tf_2.name)
assert len(found_2) == 0
assert dagbag.import_errors[tf_2.name].startswith("Ignoring DAG")
assert dagbag.dags == dags_in_bag # Should not change.
def test_zip_skip_log(self, caplog):
obey cluster pol... |
<vulnerable_code> ) -> Any | None:
""":sphinx-autoapi-skip:"""
if not exactly_one(execution_date is not None, run_id is not None):
raise ValueError("Exactly one of ti_key, run_id, or execution_date must be passed")
if run_id:
query = BaseXCom.get_many(<commit_title>[P... |
<vulnerable_code> except botocore.exceptions.ClientError as error:
return {"status": "error", "message": str(error)}
async def get_cluster_status(
self,
cluster_identifier: str,<commit_title>[PATCH 001/147] Add gitSync optional env description (#29378)<commit_description><fixed_c... |
<vulnerable_code> For more information on how to use this operator, take a look at the guide:
:ref:`howto/operator:RedshiftResumeClusterOperator`
:param cluster_identifier: id of the AWS Redshift Cluster
:param aws_conn_id: aws connection to use
"""
template_fields: Sequence[str] = ("cl... |
<vulnerable_code> redshift_operator.execute(None)
assert mock_conn.resume_cluster.call_count == 10
class TestPauseClusterOperator:
def test_init(self):<commit_title>[PATCH 001/147] Add gitSync optional env description (#29378)<commit_description><fixed_code>
redshift_operator.execut... |
<vulnerable_code> task_id="resume_cluster",
cluster_identifier=redshift_cluster_identifier,
)
# [END howto_operator_redshift_resume_cluster]
wait_cluster_available_after_resume = RedshiftClusterSensor(
pause_cluster,
wait_cluster_paused,
resume_cluster,
wait_c... |
<vulnerable_code>__all__ = [
"DAG",
"ID_LEN",
"XCOM_RETURN_KEY",
"Base",
"BaseOperator",
"BaseOperatorLink",
__lazy_imports = {
"DAG": "airflow.models.dag",
"ID_LEN": "airflow.models.base",
"XCOM_RETURN_KEY": "airflow.models.xcom",
"Base": "airflow.models.base",
"BaseOperator... |
<vulnerable_code>from airflow.models.pool import Pool
from airflow.models.taskinstance import TaskInstance, clear_task_instances
from airflow.models.taskmixin import DAGNode, DependencyMixin
from airflow.models.xcom import XCOM_RETURN_KEY
from airflow.serialization.enums import DagAttributeTypes
from airflow.ti_deps.de... |
<vulnerable_code>from airflow.utils.operator_resources import Resources
from airflow.utils.trigger_rule import TriggerRule
from airflow.utils.types import NOTSET
if TYPE_CHECKING:
import jinja2 # Slow import.
def ensure_xcomarg_return_value(arg: Any) -> None:
from airflow.models.xcom_arg import XCOM_RETURN_... |
<vulnerable_code>from airflow.models.taskfail import TaskFail
from airflow.models.taskmap import TaskMap
from airflow.models.taskreschedule import TaskReschedule
from airflow.models.xcom import XCOM_RETURN_KEY, LazyXComAccess, XCom
from airflow.plugins_manager import integrate_macros_plugins
from airflow.sentry import ... |
<vulnerable_code>from airflow.utils.session import NEW_SESSION, provide_session
from airflow.utils.sqlalchemy import UtcDateTime
log = logging.getLogger(__name__)
# MAX XCOM Size is 48KB
# https://github.com/apache/airflow/pull/1618#discussion_r68249677
MAX_XCOM_SIZE = 49344
XCOM_RETURN_KEY = "return_value"
if TYPE_... |
<vulnerable_code>from airflow.models.abstractoperator import AbstractOperator
from airflow.models.mappedoperator import MappedOperator
from airflow.models.taskmixin import DAGNode, DependencyMixin
from airflow.models.xcom import XCOM_RETURN_KEY
from airflow.utils.context import Context
from airflow.utils.edgemodifier i... |
<vulnerable_code>from airflow.models.mappedoperator import MappedOperator
from airflow.models.taskinstance import TaskInstance
from airflow.models.taskmap import TaskMap
from airflow.models.xcom import XCOM_RETURN_KEY
from airflow.models.xcom_arg import PlainXComArg, XComArg
from airflow.utils import timezone
from airf... |
<vulnerable_code>from airflow.models.param import ParamsDict
from airflow.models.taskinstance import TaskInstance
from airflow.models.taskmap import TaskMap
from airflow.models.xcom import XCOM_RETURN_KEY
from airflow.models.xcom_arg import XComArg
from airflow.utils.state import TaskInstanceState
from airflow.utils.tr... |
<vulnerable_code>from airflow.models.taskmap import TaskMap
from airflow.models.taskreschedule import TaskReschedule
from airflow.models.variable import Variable
from airflow.models.xcom import XCOM_RETURN_KEY, LazyXComAccess, XCom
from airflow.operators.bash import BashOperator
from airflow.operators.empty import Empt... |
<vulnerable_code>from airflow.configuration import conf
from airflow.models.dagrun import DagRun, DagRunType
from airflow.models.taskinstance import TaskInstance, TaskInstanceKey
from airflow.models.xcom import XCOM_RETURN_KEY, BaseXCom, XCom, resolve_xcom_backend
from airflow.operators.empty import EmptyOperator
from ... |
<vulnerable_code>from airflow.models.expandinput import EXPAND_INPUT_EMPTY
from airflow.models.mappedoperator import MappedOperator
from airflow.models.param import Param, ParamsDict
from airflow.models.xcom import XCOM_RETURN_KEY, XCom
from airflow.operators.bash import BashOperator
from airflow.operators.empty import... |
<vulnerable_code># under the License.
from __future__ import annotations
import json
from time import sleep
from typing import TYPE_CHECKING
from airflow.compat.functools import cached_property
self.log.info("executionId: %s", execution_id)
if wait_for_completion:
last_execs: dict = {}
... |
<vulnerable_code>import boto3
import botocore
import botocore.session
import requests
import tenacity
from botocore.client import ClientMeta
path = Path(__file__).parents[1].joinpath(f"waiters/{self.client_type}.json").resolve()
return path if path.exists() else None
def get_waiter(self, waiter_nam... |
<vulnerable_code> """
return self._waiter_model
def get_waiter(self, waiter_name: str) -> botocore.waiter.Waiter:
"""
Get an AWS Batch service waiter, using the configured ``.waiter_model``.
the name (including the casing) of the key name in the waiter
model ... |
<vulnerable_code>
@pytest.fixture
def hook():
with mock.patch("airflow.providers.amazon.aws.hooks.appflow.AppflowHook.__init__", return_value=None):
with mock.patch("airflow.providers.amazon.aws.hooks.appflow.AppflowHook.conn") as mock_conn:
mock_conn.describe_flow.return_value = {
... |
<vulnerable_code>import os
from base64 import b64encode
from datetime import datetime, timedelta, timezone
from unittest import mock
from unittest.mock import mock_open
from uuid import UUID
import boto3
import pytest
from botocore.config import Config
from botocore.credentials import ReadOnlyCredentials
from moto imp... |
<vulnerable_code> yield mock_conn
def run_assertions_base(appflow_conn, tasks):
appflow_conn.describe_flow.assert_called_with(flowName=FLOW_NAME)
assert appflow_conn.describe_flow.call_count == 2
appflow_conn.start_flow.assert_called_once_with(flowName=FLOW_NAME)
def test_run(appflow_conn, ctx):
... |
<vulnerable_code> mapred_queue_priority: str | None = None,
mapred_job_name: str | None = None,
hive_cli_params: str = "",
) -> None:
super().__init__()
conn = self.get_connection(hive_cli_conn_id)
self.hive_cli_params: str = hive_cli_params
self.use_beeline: b... |
<vulnerable_code> Possible settings include: VERY_HIGH, HIGH, NORMAL, LOW, VERY_LOW
:param mapred_job_name: This name will appear in the jobtracker.
This can make monitoring easier.
"""
template_fields: Sequence[str] = (
mapred_queue_priority: str | None = None,
mapred_job_na... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.