Slackbot
07/24/2023, 6:02 PMNikhil Patel
07/24/2023, 6:03 PMimport numpy as np
from <http://bentoml.io|bentoml.io> import NumpyNdarray
from pyspark.sql.types import StructType, StructField, FloatType, StringType
from pyspark.sql.types import IntegerType
from pyspark.sql.types import ArrayType
import random
import time
import bentoml
bento = bentoml.get("image_clip:latest")
schema = StructType([
StructField("image", StringType(), True),
])
batch_size = 10_000
data = [["<https://tr.rbxcdn.com/051082206a180e1625becfdb75900aa2/420/420/Model/Png>"] for _ in range(batch_size)]
df = spark.createDataFrame(data, schema)
start = time.perf_counter()
results_df = bentoml.batch.run_in_spark(bento = bento, df = df, spark = spark)
results_df.show()
end = time.perf_counter()
print("Total Time: {tot} ms".format(tot=round((end-start)*1_000, 3)))
Error:
An exception was thrown from the Python worker. Please see the stack trace below.
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/bentoml/_internal/batch/spark.py", line 87, in process
func_output = client.call(api_name, func_input)
File "/usr/local/lib/python3.7/site-packages/bentoml/_internal/client/__init__.py", line 54, in call
inp, _bentoml_api=self._svc.apis[bentoml_api_name], **kwargs
File "/usr/local/lib/python3.7/site-packages/bentoml/_internal/client/__init__.py", line 133, in _sync_call
return asyncio.run(self._call(inp, _bentoml_api=_bentoml_api, **kwargs))
File "/usr/lib64/python3.7/asyncio/runners.py", line 50, in run
loop.close()
File "/usr/lib64/python3.7/asyncio/base_events.py", line 587, in run_until_complete
return future.result()
File "/usr/local/lib/python3.7/site-packages/bentoml/_internal/client/http.py", line 180, in _call
fake_req._headers = headers # type: ignore (request._headers is property)
File "/usr/local/lib64/python3.7/site-packages/aiohttp/client.py", line 1141, in __aenter__
self._resp = await self._coro
File "/usr/local/lib64/python3.7/site-packages/aiohttp/client.py", line 671, in _request
raise
File "/usr/local/lib64/python3.7/site-packages/aiohttp/client_reqrep.py", line 914, in start
self._continue = None
File "/usr/local/lib64/python3.7/site-packages/aiohttp/helpers.py", line 721, in __exit__
raise asyncio.TimeoutError from None
concurrent.futures._base.TimeoutErrorChaoyu
07/24/2023, 7:02 PMChaoyu
07/24/2023, 7:02 PMChaoyu
07/24/2023, 7:02 PMspark.conf.set("spark.sql.execution.arrow.maxRecordsPerBatch", "1000")Chaoyu
07/24/2023, 7:02 PMChaoyu
07/24/2023, 7:03 PMapi_server.traffic.timeout=9000000 doesn’t work is because you also need to set the runner time out to a larger valueChaoyu
07/24/2023, 7:04 PMrunners:
traffic:
timeout: ....Chaoyu
07/24/2023, 7:05 PMNikhil Patel
07/25/2023, 4:59 PM"api_server.traffic.timeout=9000000 runners.traffic.timeout=9000000" , but I still seem to timeout. This even happens when I run the toy iris classifier example on 320,000 data points. Is the value I'm assigning to BENTOML_CONFIG_OPTIONS formatted correctly?Chaoyu
07/25/2023, 6:18 PMNikhil Patel
07/25/2023, 7:55 PMmb_max_latency to a higher number, but I'm not sure how to do this since
@svc.api(
input=NumpyNdarray.from_sample(
np.array([[4.9, 3.0, 1.4, 0.2]], dtype=np.double), enforce_shape=False),
output=NumpyNdarray(dtype = np.double, shape = [1],
mb_max_latency=10000000,
mb_max_batch_size=10,
batch=True),
)
throws:
TypeError: NumpyNdarray.__init__() got an unexpected keyword argument 'mb_max_latency'Nikhil Patel
07/25/2023, 11:41 PMsauyon
07/26/2023, 1:45 AMspark.executorEnv.BENTOML_CONFIG_OPTIONS if you did it on the driver.Nikhil Patel
07/26/2023, 5:58 PMsauyon
07/27/2023, 8:18 AM