A python schedulerplus client
Project description
example:
1.`export serverIp = xxx export serverPort = xxx`
2.schedulerplus_client.conf
```
[schedulerplus_client]
zk_url = localhost:2181
schedulerplus_url = localhost:8888
job_group = demogroup
```
3.demo_executor.py
```python
from schedulerplus.client.job_executor import JobExecutor
from schedulerplus.client.job_code_messages import *
class DemoExecutor(JobExecutor):
def execute(self, external_data):
print external_data
return SUCCESS_CODE, SUCCESS_MESSAGE
```
4.web_main.py
```python
import cherrypy
from schedulerplus.client.config import Config
Config.instance().load("xxx")
from schedulerplus.client.job_dispatcher import JobDispatcher
from schedulerplus.client.job_register import JobRegister
from demo.demo_executor import DemoExecutor
class JobDispatchController(object):
job_dispatcher = JobDispatcher()
@cherrypy.expose
@cherrypy.tools.json_in()
def dispatch(self):
form = cherrypy.request.json
self.job_dispatcher.dispatch(form)
if __name__ == "__main__":
JobRegister.instance().register("demo", DemoExecutor())
cherrypy.quickstart(JobDispatchController())
```
1.`export serverIp = xxx export serverPort = xxx`
2.schedulerplus_client.conf
```
[schedulerplus_client]
zk_url = localhost:2181
schedulerplus_url = localhost:8888
job_group = demogroup
```
3.demo_executor.py
```python
from schedulerplus.client.job_executor import JobExecutor
from schedulerplus.client.job_code_messages import *
class DemoExecutor(JobExecutor):
def execute(self, external_data):
print external_data
return SUCCESS_CODE, SUCCESS_MESSAGE
```
4.web_main.py
```python
import cherrypy
from schedulerplus.client.config import Config
Config.instance().load("xxx")
from schedulerplus.client.job_dispatcher import JobDispatcher
from schedulerplus.client.job_register import JobRegister
from demo.demo_executor import DemoExecutor
class JobDispatchController(object):
job_dispatcher = JobDispatcher()
@cherrypy.expose
@cherrypy.tools.json_in()
def dispatch(self):
form = cherrypy.request.json
self.job_dispatcher.dispatch(form)
if __name__ == "__main__":
JobRegister.instance().register("demo", DemoExecutor())
cherrypy.quickstart(JobDispatchController())
```
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Close
Hashes for schedulerplus-client-0.0.10b0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 848321619be8df02c3324b2a68f63fb4c42e8f91ef737c7190f36ded13f71afd |
|
MD5 | e188e4f6dfd4c123975c5eccc163c944 |
|
BLAKE2b-256 | ff95c8d0daffba2c97a6c1b556f0e7dfc5e87c19942fcdbbbec18bd5945d42e7 |