1
- # os-3m -engine
1
+ # os-m3 -engine
2
2
3
- [ ![ Build Status] ( https://www.travis-ci.org/cfhamlet/os-3m -engine.svg?branch=master )] ( https://www.travis-ci.org/cfhamlet/os-3m -engine )
4
- [ ![ codecov] ( https://codecov.io/gh/cfhamlet/os-3m -engine/branch/master/graph/badge.svg )] ( https://codecov.io/gh/cfhamlet/os-3m -engine )
5
- [ ![ PyPI - Python Version] ( https://img.shields.io/pypi/pyversions/os-3m -engine.svg )] ( https://pypi.python.org/pypi/os-3m -engine )
6
- [ ![ PyPI] ( https://img.shields.io/pypi/v/os-3m -engine.svg )] ( https://pypi.python.org/pypi/os-3m -engine )
3
+ [ ![ Build Status] ( https://www.travis-ci.org/cfhamlet/os-m3 -engine.svg?branch=master )] ( https://www.travis-ci.org/cfhamlet/os-m3 -engine )
4
+ [ ![ codecov] ( https://codecov.io/gh/cfhamlet/os-m3 -engine/branch/master/graph/badge.svg )] ( https://codecov.io/gh/cfhamlet/os-m3 -engine )
5
+ [ ![ PyPI - Python Version] ( https://img.shields.io/pypi/pyversions/os-m3 -engine.svg )] ( https://pypi.python.org/pypi/os-m3 -engine )
6
+ [ ![ PyPI] ( https://img.shields.io/pypi/v/os-m3 -engine.svg )] ( https://pypi.python.org/pypi/os-m3 -engine )
7
7
8
8
Multi-thread engine for 3(or 2) stages job.
9
9
@@ -31,34 +31,34 @@ Something else need to know:
31
31
32
32
# Install
33
33
34
- ` pip install os-3m -engine `
34
+ ` pip install os-m3 -engine `
35
35
36
36
# API
37
37
38
38
* Create default engine, a typical 3-stage job:
39
39
40
- - frontend: `` os_3m_engine .ootb.StdinFrontend`` , read from stdin, send to transport stage
41
- - transport: `` os_3m_engine .ootb.LogTransport`` , log data received from fronted, send to backend stage
42
- - backend: `` os_3m_engine .ootb.LogBackend`` , log data received from transport
40
+ - frontend: `` os_m3_engine .ootb.StdinFrontend`` , read from stdin, send to transport stage
41
+ - transport: `` os_m3_engine .ootb.LogTransport`` , log data received from fronted, send to backend stage
42
+ - backend: `` os_m3_engine .ootb.LogBackend`` , log data received from transport
43
43
44
44
```
45
- from os_3m_engine .launcher import create
45
+ from os_m3_engine .launcher import create
46
46
47
47
engine = create()
48
48
```
49
49
50
50
* Create engine with custom defined stage:
51
51
52
52
```
53
- from os_3m_engine .launcher import create
53
+ from os_m3_engine .launcher import create
54
54
55
55
engine = create(transport_cls='transport_class_path_or_class')
56
56
```
57
57
58
58
* Create engine with custom engine config:
59
59
60
60
```
61
- from os_3m_engine .launcher import create
61
+ from os_m3_engine .launcher import create
62
62
63
63
config = WhateverOjbectYouWant
64
64
config.thread_num = 10
@@ -77,7 +77,7 @@ Something else need to know:
77
77
78
78
```
79
79
from signal
80
- from os_3m_engine .launcher import create
80
+ from os_m3_engine .launcher import create
81
81
82
82
engine = create()
83
83
@@ -91,11 +91,11 @@ Something else need to know:
91
91
92
92
* Custom frontend class:
93
93
94
- - inherit from ``os_3m_engine .core.frontend.Frontend``
94
+ - inherit from ``os_m3_engine .core.frontend.Frontend``
95
95
- define ``produce`` method as generator
96
96
97
97
```
98
- from os_3m_engine .core.frontend import Frontend
98
+ from os_m3_engine .core.frontend import Frontend
99
99
100
100
class CustomFrontend(Frontend):
101
101
def produce(self):
@@ -104,11 +104,11 @@ Something else need to know:
104
104
105
105
* Custom transport class:
106
106
107
- - inherit from ``os_3m_engine .core.transport.Transport``
107
+ - inherit from ``os_m3_engine .core.transport.Transport``
108
108
- define ``transport`` method, the only parameter is the data received, the return value will be sent to backend
109
109
110
110
```
111
- from os_3m_engine .core.transport import Transport
111
+ from os_m3_engine .core.transport import Transport
112
112
113
113
class CustomTransport(Transport):
114
114
def transport(self, data):
@@ -117,11 +117,11 @@ Something else need to know:
117
117
118
118
* Custom backend class:
119
119
120
- - inherit from ``os_3m_engine .core.backend.Backend``
120
+ - inherit from ``os_m3_engine .core.backend.Backend``
121
121
- define ``process`` method, the only parameter is the data received, no need return
122
122
123
123
```
124
- from os_3m_engine .core.backend import Backend
124
+ from os_m3_engine .core.backend import Backend
125
125
126
126
class CustomBackend(Backend):
127
127
def process(self, data):
@@ -134,7 +134,7 @@ Something else need to know:
134
134
- use ``self.config`` to get the config in stage class
135
135
136
136
```
137
- from os_3m_engine .launcher import create
137
+ from os_m3_engine .launcher import create
138
138
139
139
config = WhateverOjbectYouWant
140
140
engine = create(app_config=config)
@@ -148,7 +148,7 @@ Something else need to know:
148
148
149
149
150
150
```
151
- from os_3m_engine .core.backend import Backend
151
+ from os_m3_engine .core.backend import Backend
152
152
153
153
class CustomBackend(Backend):
154
154
0 commit comments