mikebridge commented on code in PR #45532:
URL: https://github.com/apache/superset/pull/45532#discussion_r4331560977


##########
superset/semantic_layers/api.py:
##########
@@ -379,13 +415,32 @@ def post(self) -> Response:
 
         body = request.json or {}
         views_data = body.get("views", [])
-        if not views_data:
-            return self.response_400(message="No views provided")
+        if refusal := _bulk_create_refusal(views_data):
+            return self.response_400(message=refusal)
 
         schema = SemanticViewPostSchema()
         created = []
         errors = []
+        # Checked between lookups only: an in-flight provider call is bounded 
by
+        # the semantic layer's own timeouts.
+        deadline = (
+            time.monotonic() + 
current_app.config["SEMANTIC_VIEW_BULK_CREATE_TIMEOUT"]
+        )
+        timed_out = 0
         for view_data in views_data:
+            if time.monotonic() >= deadline:

Review Comment:
   That's correct, and it is a deliberate limit of this change rather than a 
gap in it. The budget is checked between lookups, so a lookup that is already 
running finishes on the provider's own timeouts before the remaining views are 
reported as `TIMEOUT`. The worst case is the budget plus one lookup, not an 
unbounded wait across the batch.
   
   This is stated in the `SEMANTIC_VIEW_BULK_CREATE_TIMEOUT` comment in 
`superset/config.py`, in the semantic layer connections docs, and in the PR 
description. The default is 30 seconds so that this extra lookup still fits 
under the default 60 second web server timeout.
   
   Interrupting the call itself would need either threads around a synchronous 
provider call, which would leave the provider's work running anyway, or a 
timeout in the provider contract that reaches its transport. The second option 
is the right fix, and it is separate work on the provider HTTP transport, so 
I'm leaving this as is here.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to