-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Labels
Description
Describe your proposal/problem
I've been looking for a way to pass http request headers to my Executor, and this is the only way I've been able to do it.
class MyGateway(FastAPIBaseGateway):
@property
def app(self):
from fastapi import FastAPI
app = FastAPI(title="Test Gateway")
@app.get(path="/config")
async def custom_endpoint(my_input: MyInput, request: Request):
docs1: DocList[RequestOutput] = await self.executor["executor0"].post(
on="/api/v0/test",
inputs=DocList[Input]([my_input]),
parameters=request.headers or {"no": "headers"},
return_type=DocList[RequestOutput],
)
return docs1.to_json()
return app
Is there a simpler way to do this? The approach above only works for flows, is there a way that works for deployments?
Environment
- jina 3.20.3
- docarray 0.33.0
- jcloud 0.2.16
- jina-hubble-sdk 0.39.0
- jina-proto 0.1.27
- protobuf 3.20.0
- proto-backend python
- grpcio 1.48.0rc1
- pyyaml 6.0.1
- python 3.9.17
- platform Darwin
- platform-release 22.6.0
- platform-version Darwin Kernel Version 22.6.0: Wed Jul 5 22:21:53
PDT 2023; root:xnu-8796.141.3~6/RELEASE_ARM64_T6020 - architecture arm64
- processor arm
- uid 11592019587001
- session-id 0062ff1e-574c-11ee-9138-0a8afa35afb9
- uptime 2023-09-19T17:24:02.674004
- ci-vendor (unset)
- internal False
- JINA_DEFAULT_HOST (unset)
- JINA_DEFAULT_TIMEOUT_CTRL (unset)
- JINA_DEPLOYMENT_NAME (unset)
- JINA_DISABLE_UVLOOP (unset)
- JINA_EARLY_STOP (unset)
- JINA_FULL_CLI (unset)
- JINA_GATEWAY_IMAGE (unset)
- JINA_GRPC_RECV_BYTES (unset)
- JINA_GRPC_SEND_BYTES (unset)
- JINA_HUB_NO_IMAGE_REBUILD (unset)
- JINA_LOG_CONFIG (unset)
- JINA_LOG_LEVEL (unset)
- JINA_LOG_NO_COLOR (unset)
- JINA_MP_START_METHOD (unset)
- JINA_OPTOUT_TELEMETRY (unset)
- JINA_RANDOM_PORT_MAX (unset)
- JINA_RANDOM_PORT_MIN (unset)
- JINA_LOCKS_ROOT (unset)
- JINA_K8S_ACCESS_MODES (unset)
- JINA_K8S_STORAGE_CLASS_NAME (unset)
- JINA_K8S_STORAGE_CAPACITY (unset)
- JINA_STREAMER_ARGS (unset)
dkmiller