Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,16 @@
under the License.
-->

# v3.1.4
# v3.1.6

## Bug Fixes:

- Update refresh token flow ([#55506](https://github.com/apache/airflow/pull/55506))
- Patch pools should have an optional description ([#58066](https://github.com/apache/airflow/pull/58066))
- Patch pools should have an optional description ([#58066](https://github.com/apache/airflow/pull/58066))(#59728)
- Add task group ID filtering support to task instance query [#59511](https://github.com/apache/airflow/pull/59511)
- Fix backfill run_on_latest_version defaulting to False instead of True [#59328](https://github.com/apache/airflow/pull/59328)
- Update refresh token flow [#58649](https://github.com/apache/airflow/pull/58649)
- Patch pools should have an optional description [#58169](https://github.com/apache/airflow/pull/58169)

# v3.1.3

Expand Down
556 changes: 372 additions & 184 deletions airflow_client/client/__init__.py

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions airflow_client/client/api/dag_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
from airflow_client.client.models.dag_patch_body import DAGPatchBody
from airflow_client.client.models.dag_response import DAGResponse
from airflow_client.client.models.dag_tag_collection_response import DAGTagCollectionResponse
from airflow_client.client.models.dag_run_state import DagRunState

from airflow_client.client.api_client import ApiClient, RequestSerialized
from airflow_client.client.api_response import ApiResponse
Expand Down Expand Up @@ -1488,7 +1487,7 @@ def get_dags(
exclude_stale: Optional[StrictBool] = None,
paused: Optional[StrictBool] = None,
has_import_errors: Annotated[Optional[StrictBool], Field(description="Filter Dags by having import errors. Only Dags that have been successfully loaded before will be returned.")] = None,
last_dag_run_state: Optional[DagRunState] = None,
last_dag_run_state: Optional[Any] = None,
bundle_name: Optional[StrictStr] = None,
bundle_version: Optional[StrictStr] = None,
has_asset_schedule: Annotated[Optional[StrictBool], Field(description="Filter Dags with asset-based scheduling")] = None,
Expand Down Expand Up @@ -1658,7 +1657,7 @@ def get_dags_with_http_info(
exclude_stale: Optional[StrictBool] = None,
paused: Optional[StrictBool] = None,
has_import_errors: Annotated[Optional[StrictBool], Field(description="Filter Dags by having import errors. Only Dags that have been successfully loaded before will be returned.")] = None,
last_dag_run_state: Optional[DagRunState] = None,
last_dag_run_state: Optional[Any] = None,
bundle_name: Optional[StrictStr] = None,
bundle_version: Optional[StrictStr] = None,
has_asset_schedule: Annotated[Optional[StrictBool], Field(description="Filter Dags with asset-based scheduling")] = None,
Expand Down Expand Up @@ -1828,7 +1827,7 @@ def get_dags_without_preload_content(
exclude_stale: Optional[StrictBool] = None,
paused: Optional[StrictBool] = None,
has_import_errors: Annotated[Optional[StrictBool], Field(description="Filter Dags by having import errors. Only Dags that have been successfully loaded before will be returned.")] = None,
last_dag_run_state: Optional[DagRunState] = None,
last_dag_run_state: Optional[Any] = None,
bundle_name: Optional[StrictStr] = None,
bundle_version: Optional[StrictStr] = None,
has_asset_schedule: Annotated[Optional[StrictBool], Field(description="Filter Dags with asset-based scheduling")] = None,
Expand Down
9 changes: 4 additions & 5 deletions airflow_client/client/api/dag_warning_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@
from typing_extensions import Annotated

from pydantic import Field, StrictStr
from typing import List, Optional
from typing import Any, List, Optional
from typing_extensions import Annotated
from airflow_client.client.models.dag_warning_collection_response import DAGWarningCollectionResponse
from airflow_client.client.models.dag_warning_type import DagWarningType

from airflow_client.client.api_client import ApiClient, RequestSerialized
from airflow_client.client.api_response import ApiResponse
Expand All @@ -44,7 +43,7 @@ def __init__(self, api_client=None) -> None:
def list_dag_warnings(
self,
dag_id: Optional[StrictStr] = None,
warning_type: Optional[DagWarningType] = None,
warning_type: Optional[Any] = None,
limit: Optional[Annotated[int, Field(strict=True, ge=0)]] = None,
offset: Optional[Annotated[int, Field(strict=True, ge=0)]] = None,
order_by: Annotated[Optional[List[StrictStr]], Field(description="Attributes to order by, multi criteria sort is supported. Prefix with `-` for descending order. Supported attributes: `dag_id, warning_type, message, timestamp`")] = None,
Expand Down Expand Up @@ -130,7 +129,7 @@ def list_dag_warnings(
def list_dag_warnings_with_http_info(
self,
dag_id: Optional[StrictStr] = None,
warning_type: Optional[DagWarningType] = None,
warning_type: Optional[Any] = None,
limit: Optional[Annotated[int, Field(strict=True, ge=0)]] = None,
offset: Optional[Annotated[int, Field(strict=True, ge=0)]] = None,
order_by: Annotated[Optional[List[StrictStr]], Field(description="Attributes to order by, multi criteria sort is supported. Prefix with `-` for descending order. Supported attributes: `dag_id, warning_type, message, timestamp`")] = None,
Expand Down Expand Up @@ -216,7 +215,7 @@ def list_dag_warnings_with_http_info(
def list_dag_warnings_without_preload_content(
self,
dag_id: Optional[StrictStr] = None,
warning_type: Optional[DagWarningType] = None,
warning_type: Optional[Any] = None,
limit: Optional[Annotated[int, Field(strict=True, ge=0)]] = None,
offset: Optional[Annotated[int, Field(strict=True, ge=0)]] = None,
order_by: Annotated[Optional[List[StrictStr]], Field(description="Attributes to order by, multi criteria sort is supported. Prefix with `-` for descending order. Supported attributes: `dag_id, warning_type, message, timestamp`")] = None,
Expand Down
17 changes: 17 additions & 0 deletions airflow_client/client/api/task_instance_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -6357,6 +6357,7 @@ def get_task_instances(
duration_lte: Optional[Union[StrictFloat, StrictInt]] = None,
duration_lt: Optional[Union[StrictFloat, StrictInt]] = None,
task_display_name_pattern: Annotated[Optional[StrictStr], Field(description="SQL LIKE expression — use `%` / `_` wildcards (e.g. `%customer_%`). Regular expressions are **not** supported.")] = None,
task_group_id: Annotated[Optional[StrictStr], Field(description="Filter by exact task group ID. Returns all tasks within the specified task group.")] = None,
state: Optional[List[StrictStr]] = None,
pool: Optional[List[StrictStr]] = None,
queue: Optional[List[StrictStr]] = None,
Expand Down Expand Up @@ -6441,6 +6442,8 @@ def get_task_instances(
:type duration_lt: float
:param task_display_name_pattern: SQL LIKE expression — use `%` / `_` wildcards (e.g. `%customer_%`). Regular expressions are **not** supported.
:type task_display_name_pattern: str
:param task_group_id: Filter by exact task group ID. Returns all tasks within the specified task group.
:type task_group_id: str
:param state:
:type state: List[str]
:param pool:
Expand Down Expand Up @@ -6514,6 +6517,7 @@ def get_task_instances(
duration_lte=duration_lte,
duration_lt=duration_lt,
task_display_name_pattern=task_display_name_pattern,
task_group_id=task_group_id,
state=state,
pool=pool,
queue=queue,
Expand Down Expand Up @@ -6580,6 +6584,7 @@ def get_task_instances_with_http_info(
duration_lte: Optional[Union[StrictFloat, StrictInt]] = None,
duration_lt: Optional[Union[StrictFloat, StrictInt]] = None,
task_display_name_pattern: Annotated[Optional[StrictStr], Field(description="SQL LIKE expression — use `%` / `_` wildcards (e.g. `%customer_%`). Regular expressions are **not** supported.")] = None,
task_group_id: Annotated[Optional[StrictStr], Field(description="Filter by exact task group ID. Returns all tasks within the specified task group.")] = None,
state: Optional[List[StrictStr]] = None,
pool: Optional[List[StrictStr]] = None,
queue: Optional[List[StrictStr]] = None,
Expand Down Expand Up @@ -6664,6 +6669,8 @@ def get_task_instances_with_http_info(
:type duration_lt: float
:param task_display_name_pattern: SQL LIKE expression — use `%` / `_` wildcards (e.g. `%customer_%`). Regular expressions are **not** supported.
:type task_display_name_pattern: str
:param task_group_id: Filter by exact task group ID. Returns all tasks within the specified task group.
:type task_group_id: str
:param state:
:type state: List[str]
:param pool:
Expand Down Expand Up @@ -6737,6 +6744,7 @@ def get_task_instances_with_http_info(
duration_lte=duration_lte,
duration_lt=duration_lt,
task_display_name_pattern=task_display_name_pattern,
task_group_id=task_group_id,
state=state,
pool=pool,
queue=queue,
Expand Down Expand Up @@ -6803,6 +6811,7 @@ def get_task_instances_without_preload_content(
duration_lte: Optional[Union[StrictFloat, StrictInt]] = None,
duration_lt: Optional[Union[StrictFloat, StrictInt]] = None,
task_display_name_pattern: Annotated[Optional[StrictStr], Field(description="SQL LIKE expression — use `%` / `_` wildcards (e.g. `%customer_%`). Regular expressions are **not** supported.")] = None,
task_group_id: Annotated[Optional[StrictStr], Field(description="Filter by exact task group ID. Returns all tasks within the specified task group.")] = None,
state: Optional[List[StrictStr]] = None,
pool: Optional[List[StrictStr]] = None,
queue: Optional[List[StrictStr]] = None,
Expand Down Expand Up @@ -6887,6 +6896,8 @@ def get_task_instances_without_preload_content(
:type duration_lt: float
:param task_display_name_pattern: SQL LIKE expression — use `%` / `_` wildcards (e.g. `%customer_%`). Regular expressions are **not** supported.
:type task_display_name_pattern: str
:param task_group_id: Filter by exact task group ID. Returns all tasks within the specified task group.
:type task_group_id: str
:param state:
:type state: List[str]
:param pool:
Expand Down Expand Up @@ -6960,6 +6971,7 @@ def get_task_instances_without_preload_content(
duration_lte=duration_lte,
duration_lt=duration_lt,
task_display_name_pattern=task_display_name_pattern,
task_group_id=task_group_id,
state=state,
pool=pool,
queue=queue,
Expand Down Expand Up @@ -7021,6 +7033,7 @@ def _get_task_instances_serialize(
duration_lte,
duration_lt,
task_display_name_pattern,
task_group_id,
state,
pool,
queue,
Expand Down Expand Up @@ -7351,6 +7364,10 @@ def _get_task_instances_serialize(

_query_params.append(('task_display_name_pattern', task_display_name_pattern))

if task_group_id is not None:

_query_params.append(('task_group_id', task_group_id))

if state is not None:

_query_params.append(('state', state))
Expand Down
25 changes: 16 additions & 9 deletions airflow_client/client/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import os
import re
import tempfile
import uuid

from urllib.parse import quote
from typing import Tuple, Optional, List, Dict, Union
Expand Down Expand Up @@ -90,7 +91,7 @@ def __init__(
self.default_headers[header_name] = header_value
self.cookie = cookie
# Set default User-Agent.
self.user_agent = 'OpenAPI-Generator/3.1.4/python'
self.user_agent = 'OpenAPI-Generator/3.1.6/python'
self.client_side_validation = configuration.client_side_validation

def __enter__(self):
Expand Down Expand Up @@ -311,7 +312,7 @@ def response_deserialize(
return_data = self.__deserialize_file(response_data)
elif response_type is not None:
match = None
content_type = response_data.getheader('content-type')
content_type = response_data.headers.get('content-type')
if content_type is not None:
match = re.search(r"charset=([a-zA-Z\-\d]+)[\s;]?", content_type)
encoding = match.group(1) if match else "utf-8"
Expand All @@ -328,7 +329,7 @@ def response_deserialize(
return ApiResponse(
status_code = response_data.status,
data = return_data,
headers = response_data.getheaders(),
headers = response_data.headers,
raw_data = response_data.data
)

Expand Down Expand Up @@ -356,6 +357,8 @@ def sanitize_for_serialization(self, obj):
return obj.get_secret_value()
elif isinstance(obj, self.PRIMITIVE_TYPES):
return obj
elif isinstance(obj, uuid.UUID):
return str(obj)
elif isinstance(obj, list):
return [
self.sanitize_for_serialization(sub_obj) for sub_obj in obj
Expand All @@ -382,6 +385,10 @@ def sanitize_for_serialization(self, obj):
else:
obj_dict = obj.__dict__

if isinstance(obj_dict, list):
# here we handle instances that can either be a list or something else, and only became a real list by calling to_dict()
return self.sanitize_for_serialization(obj_dict)

return {
key: self.sanitize_for_serialization(val)
for key, val in obj_dict.items()
Expand All @@ -404,7 +411,7 @@ def deserialize(self, response_text: str, response_type: str, content_type: Opti
data = json.loads(response_text)
except ValueError:
data = response_text
elif re.match(r'^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)', content_type, re.IGNORECASE):
elif re.match(r'^application/(json|[\w!#$&.+\-^_]+\+json)\s*(;|$)', content_type, re.IGNORECASE):
if response_text == "":
data = ""
else:
Expand Down Expand Up @@ -453,13 +460,13 @@ def __deserialize(self, data, klass):

if klass in self.PRIMITIVE_TYPES:
return self.__deserialize_primitive(data, klass)
elif klass == object:
elif klass is object:
return self.__deserialize_object(data)
elif klass == datetime.date:
elif klass is datetime.date:
return self.__deserialize_date(data)
elif klass == datetime.datetime:
elif klass is datetime.datetime:
return self.__deserialize_datetime(data)
elif klass == decimal.Decimal:
elif klass is decimal.Decimal:
return decimal.Decimal(data)
elif issubclass(klass, Enum):
return self.__deserialize_enum(data, klass)
Expand Down Expand Up @@ -694,7 +701,7 @@ def __deserialize_file(self, response):
os.close(fd)
os.remove(path)

content_disposition = response.getheader("Content-Disposition")
content_disposition = response.headers.get("Content-Disposition")
if content_disposition:
m = re.search(
r'filename=[\'"]?([^\'"\s]+)[\'"]?',
Expand Down
12 changes: 9 additions & 3 deletions airflow_client/client/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ class Configuration:
:param retries: Number of retries for API requests.
:param ca_cert_data: verify the peer using concatenated CA certificate data
in PEM (str) or DER (bytes) format.
:param cert_file: the path to a client certificate file, for mTLS.
:param key_file: the path to a client key file, for mTLS.

:Example:
"""
Expand All @@ -186,6 +188,8 @@ def __init__(
ssl_ca_cert: Optional[str]=None,
retries: Optional[int] = None,
ca_cert_data: Optional[Union[str, bytes]] = None,
cert_file: Optional[str]=None,
key_file: Optional[str]=None,
*,
debug: Optional[bool] = None,
) -> None:
Expand Down Expand Up @@ -267,10 +271,10 @@ def __init__(
"""Set this to verify the peer using PEM (str) or DER (bytes)
certificate data.
"""
self.cert_file = None
self.cert_file = cert_file
"""client certificate file
"""
self.key_file = None
self.key_file = key_file
"""client key file
"""
self.assert_hostname = None
Expand Down Expand Up @@ -483,6 +487,7 @@ def get_basic_auth_token(self) -> Optional[str]:
password = ""
if self.password is not None:
password = self.password

return urllib3.util.make_headers(
basic_auth=username + ':' + password
).get('authorization')
Expand Down Expand Up @@ -518,7 +523,7 @@ def to_debug_report(self) -> str:
"OS: {env}\n"\
"Python Version: {pyversion}\n"\
"Version of the API: 2\n"\
"SDK Package Version: 3.1.4".\
"SDK Package Version: 3.1.6".\
format(env=sys.platform, pyversion=sys.version)

def get_host_settings(self) -> List[HostSetting]:
Expand Down Expand Up @@ -566,6 +571,7 @@ def get_host_from_settings(
variable_name, variable['default_value'])

if 'enum_values' in variable \
and variable['enum_values'] \
and used_value not in variable['enum_values']:
raise ValueError(
"The variable `{0}` in the host URL has invalid value "
Expand Down
9 changes: 6 additions & 3 deletions airflow_client/client/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def __init__(
self.body = http_resp.data.decode('utf-8')
except Exception:
pass
self.headers = http_resp.getheaders()
self.headers = http_resp.headers

@classmethod
def from_response(
Expand Down Expand Up @@ -169,8 +169,11 @@ def __str__(self):
error_message += "HTTP response headers: {0}\n".format(
self.headers)

if self.data or self.body:
error_message += "HTTP response body: {0}\n".format(self.data or self.body)
if self.body:
error_message += "HTTP response body: {0}\n".format(self.body)

if self.data:
error_message += "HTTP response data: {0}\n".format(self.data)

return error_message

Expand Down
2 changes: 1 addition & 1 deletion airflow_client/client/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
Do not edit the class manually.
""" # noqa: E501


# import models into model package
from airflow_client.client.models.app_builder_menu_item_response import AppBuilderMenuItemResponse
from airflow_client.client.models.app_builder_view_response import AppBuilderViewResponse
Expand Down Expand Up @@ -162,3 +161,4 @@
from airflow_client.client.models.x_com_response_native import XComResponseNative
from airflow_client.client.models.x_com_response_string import XComResponseString
from airflow_client.client.models.x_com_update_body import XComUpdateBody

Loading