jscheffl commented on code in PR #60108:
URL: https://github.com/apache/airflow/pull/60108#discussion_r3088750164


##########
airflow-core/src/airflow/config_templates/config.yml:
##########
@@ -2093,6 +2093,15 @@ execution_api:
       type: integer
       example: ~
       default: "600"
+    jwt_workload_token_expiration_time:

Review Comment:
   I thought a moment about this and actually am thinking... do we need a 
config parameter for this? There is a parameter `task_queued_timeout` already 
(see 
https://airflow.apache.org/docs/apache-airflow/stable/configurations-ref.html#task-queued-timeout)
 - after this tasks are made failed if they starve in the queue.
   
   Would it be also an idea to make expiration of JWT equal to the queue 
timeout? (Maybe a few seconds more as buffer...) - I see no reason making this 
JWT defautl to 24h if the task is evicted from queued state after 10min per 
default (which usually is a good idea to set higher in a loaded environment)



##########
airflow-core/src/airflow/api_fastapi/execution_api/routes/task_instances.py:
##########
@@ -287,14 +292,24 @@ def ti_run(
         if ti.next_method:
             context.next_method = ti.next_method
             context.next_kwargs = ti.next_kwargs
-
-        return context
     except SQLAlchemyError:
         log.exception("Error marking Task Instance state as running")
         raise HTTPException(
             status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, 
detail="Database error occurred"
         )
 
+    try:
+        generator: JWTGenerator = services.get(JWTGenerator)
+        execution_token = generator.generate(extras={"sub": 
str(task_instance_id), "scope": "execution"})
+    except Exception:

Review Comment:
   Do we need a broad exception here or can we point to specific one(s)?



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