ashb commented on code in PR #52846:
URL: https://github.com/apache/airflow/pull/52846#discussion_r2203256211
##########
task-sdk/src/airflow/sdk/api/client.py:
##########
@@ -305,18 +305,29 @@ def get(self, conn_id: str) -> ConnectionResponse |
ErrorResponse:
class VariableOperations:
__slots__ = ("client",)
+ __NO_DEFAULT_SENTINEL = object()
def __init__(self, client: Client):
self.client = client
- def get(self, key: str) -> VariableResponse | ErrorResponse:
+ def get(self, key: str, default_var: Any = __NO_DEFAULT_SENTINEL) ->
VariableResponse | ErrorResponse:
"""Get a variable from the API server."""
try:
resp = self.client.get(f"variables/{key}")
except ServerResponseError as e:
if e.response.status_code == HTTPStatus.NOT_FOUND:
+ if default_var is not self.__NO_DEFAULT_SENTINEL:
+ log.debug(
+ "Variable %s not found. Using default",
+ key,
Review Comment:
```suggestion
"Variable not found. Using default",
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]