The 504 Gateway Timeout error you're seeing is due to the server not getting a timely response from the Airflow backfill command. This is because the backfill operation takes time and doesn't instantly return a response.
Instead of waiting for the backfill operation to complete, I think we can return a response immediately to the client and let the operation continue in the background.
def_backfill(self):
log.info("Extended API backfill called")
body=request.get_json()
try:
command_list, username=backfillDAGRunSchema.load(body)
exceptValidationErroraserr:
raiseBadRequest(detail=str(err.messages))
# For backfilling: API will get 504 Gateway Time-out due to taking time to finish# output = execute_cli_command(command_list, username)# result = commandExecutionResult.load(output)thread=threading.Thread(target=execute_cli_command, args=(command_list, username))
thread.start()
return {"message": "Backfill operation started"}, 202