Skip to main content

基于python标准库concurrent & requests封装tritonclient

Project description

tritonclient-futures

特性

  • 基于标准库concurrent与requests封装.
  • 完整复现tritonclient,上手简单.

安装

pip install tritonclient-futures

示例

from tritonclient_futures import InferenceServerClient, InferInput, InferRequestedOutput, as_completed
# 客户端初始化
## url: tritonserver http url
## concurrency: 线程数
## pool_connections: 连接池个数
## pool_maxsize: 连接池的连接个数
client = InferenceServerClient(url='127.0.0.1:8000', concurrency=100, pool_connections=100, pool_maxsize=200)
# 同步调用
client.infer(model_name=model_name, inputs=inputs, outputs=outputs)

# 异步调用
fs = []
for i in iters:
    fs.append(client.async_infer(model_name=i["model_name"], inputs=i["inputs"], outputs=i["outputs"]))

resps = [f.get_result() for f in as_completed(fs)]

性能

不如grpc,不如gevent/aio

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tritonclient_futures-0.9.0-py3-none-any.whl (15.5 kB view details)

Uploaded Python 3

File details

Details for the file tritonclient_futures-0.9.0-py3-none-any.whl.

File metadata

  • Download URL: tritonclient_futures-0.9.0-py3-none-any.whl
  • Upload date:
  • Size: 15.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.10

File hashes

Hashes for tritonclient_futures-0.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a34a30a9c2b390096200b74e15ed4026546994992cf832914c6937b5f9233f3c
MD5 88a4d0b552771d6641bcd17bf81329f2
BLAKE2b-256 9c8a65f189a3fc18cebb4838dadc034d96674b3d19a7f5b25a86d2dcd2a2f31b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page