mirror of
https://github.com/vale981/ray
synced 2025-03-06 10:31:39 -05:00
[Serve] Fix handle args data type issue (#10629)
This commit is contained in:
parent
5851e893ee
commit
8d5b8b2956
1 changed files with 11 additions and 3 deletions
|
@ -10,11 +10,11 @@ from typing import List
|
|||
import io
|
||||
import os
|
||||
from ray.serve.exceptions import RayServeException
|
||||
from collections import UserDict
|
||||
|
||||
import requests
|
||||
import numpy as np
|
||||
import pydantic
|
||||
from werkzeug.datastructures import ImmutableMultiDict
|
||||
|
||||
import ray
|
||||
from ray.serve.constants import HTTP_PROXY_TIMEOUT
|
||||
|
@ -24,6 +24,14 @@ from ray.serve.http_util import build_flask_request
|
|||
ACTOR_FAILURE_RETRY_TIMEOUT_S = 60
|
||||
|
||||
|
||||
class ServeMultiDict(UserDict):
|
||||
"""Compatible data structure to simulate Flask.Request.args API."""
|
||||
|
||||
def getlist(self, key):
|
||||
"""Return the list of items for a given key."""
|
||||
return self.data.get(key, [])
|
||||
|
||||
|
||||
class ServeRequest:
|
||||
"""The request object used in Python context.
|
||||
|
||||
|
@ -34,7 +42,7 @@ class ServeRequest:
|
|||
|
||||
def __init__(self, data, kwargs, headers, method):
|
||||
self._data = data
|
||||
self._kwargs = kwargs
|
||||
self._kwargs = ServeMultiDict(kwargs)
|
||||
self._headers = headers
|
||||
self._method = method
|
||||
|
||||
|
@ -51,7 +59,7 @@ class ServeRequest:
|
|||
@property
|
||||
def args(self):
|
||||
"""The keyword arguments from ``handle.remote(**kwargs)``."""
|
||||
return ImmutableMultiDict(self._kwargs)
|
||||
return self._kwargs
|
||||
|
||||
@property
|
||||
def json(self):
|
||||
|
|
Loading…
Add table
Reference in a new issue