Upgrade to Pro — share decks privately, control downloads, hide ads and more …

PyCon2014China-Zhuhai-bpm.py

Zoom.Quiet
November 17, 2014

 PyCon2014China-Zhuhai-bpm.py

Zoom.Quiet

November 17, 2014
Tweet

More Decks by Zoom.Quiet

Other Decks in Technology

Transcript

  1. 所谓Event Loop def some_process(): sock = connect(‘a.b.c.d’, on_connect) sock.send(‘xxx’) bytes

    = sock.recv(on_received) …. 协程 Event Loop fd_map = {} [fd, read] => coroutine 操作系统 select kqueue epoll recv好了告诉我, 我先睡你那了 select(sock, EV_READ) fd 132 可读了 fd 132 对应的协程醒醒 开读了
  2. 协程可以存数据库的 def some_process(): ip = res.request_new_server(model=’B6’) yes_no = smcs.wechat_approve(‘deploy %s?’

    % ip) if yes_no: ijobs.exec_job(‘deploy’, ip) 协程 引擎 event_map = {} event => coroutine 外部系统 审批好了告诉我, 我先睡你那了 wechat approve 审批结果有了 审批好了,协程醒醒 开工了 mysql import cPickle bytes = cPickle.dumps(coroutine)
  3. Ultimate Coroutine Scheduler • 语言:Java for true parallelism • 协程:co-routine

    with bytecode weaver • I/O阻塞:包装NIO • 流程阻塞:event map,持久化可选 https://github.com/taowen/daili