Skip to main content

继承这个包中的FuncClass写一个它的子类,重写它的predict方法可以从/register/接口来动态运行这个predict方法, 然后通过post方式将代码放入请求的body体中,就可以动态运行这个方法。可以通过/add/和/reduce/减少可以可以同时存在的子类数量。 启动工程方法 实例 pyengine run -p 5000 -n 50

Project description

# 使用指南

1、pip install pyengine

2、运行命令 pyengine run -d 缓存目录 -p 端口号 -n 可同时处理的请求数量

3、接口
/run/
body 体为一个FuncClass的子类


```python
from pyengine import FuncClass
import time
class My2(FuncClass):
def run(self):
print('MY is Running')
time.sleep(1)
return "你好啊!"
```

返回结果为

```json
{
"res": "你好啊!"
}
```

/add/

增加n的个数

/reduce/

减少n的个数

4、新增一个异步装饰器

```python
from pyengine import async_work_res
def deal_res(res):
print('res')

@async_work_res(deal_res)
def work():
return '大家好!'
```

可以使被装饰的函数启动一个进程或者线程去执行(在win下启动线程,在linux下启动进程),该装饰器的参数是一个可以处理被装饰的函数的结果

Project details


Download files

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

Source Distribution

pyengine-0.0.2.tar.gz (3.3 kB view details)

Uploaded Source

File details

Details for the file pyengine-0.0.2.tar.gz.

File metadata

  • Download URL: pyengine-0.0.2.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.0

File hashes

Hashes for pyengine-0.0.2.tar.gz
Algorithm Hash digest
SHA256 80e7480ad55d38278588ef972171df995ccfc70d73be9016e76b79549f03c3e8
MD5 0b9b0858de9000c3cda416939c226bef
BLAKE2b-256 02d3150c042ebe02b73091776e8edb61bdff2ddd0e5099e55414e6c74159399e

See more details on using hashes here.

Supported by

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