vincbeck commented on code in PR #28693:
URL: https://github.com/apache/airflow/pull/28693#discussion_r1066412297


##########
airflow/api_internal/internal_api_call.py:
##########
@@ -94,21 +93,20 @@ def make_jsonrpc_request(method_name: str, params_json: 
str) -> bytes:
         return response.content
 
     @wraps(func)
-    def wrapper(*args, **kwargs) -> RT | None:
+    def wrapper(*args, **kwargs) -> RT:
         use_internal_api = InternalApiConfig.get_use_internal_api()
         if not use_internal_api:
             return func(*args, **kwargs)
 
+        from airflow.serialization.serialized_objects import BaseSerialization 
 # avoid circular import
+
         bound = inspect.signature(func).bind(*args, **kwargs)
         arguments_dict = dict(bound.arguments)
         if "session" in arguments_dict:
             del arguments_dict["session"]
         args_json = json.dumps(BaseSerialization.serialize(arguments_dict))
-        method_name = f"{func.__module__}.{func.__name__}"
+        method_name = f"{func.__module__}.{func.__qualname__}"
         result = make_jsonrpc_request(method_name, args_json)
-        if result:

Review Comment:
   `result` is never `None` because if there is not output of the function we 
send an empty JSON. [See 
here](https://github.com/apache/airflow/blob/main/airflow/api_internal/endpoints/rpc_api_endpoint.py#L75)



##########
airflow/api_internal/internal_api_call.py:
##########
@@ -94,21 +93,20 @@ def make_jsonrpc_request(method_name: str, params_json: 
str) -> bytes:
         return response.content
 
     @wraps(func)
-    def wrapper(*args, **kwargs) -> RT | None:
+    def wrapper(*args, **kwargs) -> RT:
         use_internal_api = InternalApiConfig.get_use_internal_api()
         if not use_internal_api:
             return func(*args, **kwargs)
 
+        from airflow.serialization.serialized_objects import BaseSerialization 
 # avoid circular import
+
         bound = inspect.signature(func).bind(*args, **kwargs)
         arguments_dict = dict(bound.arguments)
         if "session" in arguments_dict:
             del arguments_dict["session"]
         args_json = json.dumps(BaseSerialization.serialize(arguments_dict))
-        method_name = f"{func.__module__}.{func.__name__}"
+        method_name = f"{func.__module__}.{func.__qualname__}"
         result = make_jsonrpc_request(method_name, args_json)
-        if result:

Review Comment:
   Having the type `RT | None` as return type was introducing some issues like 
[here](https://github.com/apache/airflow/blob/main/airflow/dag_processing/processor.py#L793).
 `paused_dag_ids` could be `None` and Python did not like it (rightfully so)



-- 
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]

Reply via email to