title: 聊聊任务分发 speaker: Zhang Yu transition: zoomin theme: moon usemathjax: no date: 2016年10月18日
[slide]
如何实现可靠的任务分发
| FROM python:3-stretch | |
| ENV TZ=Asia/Shanghai | |
| RUN pip install --no-cache-dir -i https://pypi.douban.com/simple requests | |
| COPY cleanup-docker-registry.py /cleanup-docker-registry.py | |
| VOLUME ["/registry"] | |
| ENTRYPOINT ["python", "/cleanup-docker-registry.py", "--storage", "/registry"] |
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| ''' | |
| A lint tool for robotframework cases. | |
| Robotframework best practices: | |
| TODO | |
| Supported checking points: |
| var client = {}; | |
| client.run = function (options) { | |
| options = options || {}; | |
| var socket = io.connect(options.remote || "http://localhost:8080"); | |
| socket.on('connect', function() { | |
| var term = new Terminal({ |
| import signal | |
| from robot.running import EXECUTION_CONTEXTS | |
| from robot.running import Keyword | |
| import thread | |
| import os | |
| def stop_after_5_seconds(): | |
| def _stop_execution(signum, frame): | |
| Keyword('fatal error', ()).run(EXECUTION_CONTEXTS.current) | |
| def _after_5_seconds(): |
| def generate_prime_factors(n): | |
| primes = [] | |
| factor = 2 | |
| while factor <= n: | |
| while n % factor == 0: | |
| primes.append(factor) | |
| n /= factor | |
| factor += 1 | |
| return primes |
| # lib.py | |
| import signal | |
| from robot.running import EXECUTION_CONTEXTS | |
| from robot.running.keywords import Keyword | |
| import thread | |
| import os | |
| def do_error_log_monitoring(): | |
| def _stop_execution(signum, frame): | |
| Keyword('fatal error', ()).run(EXECUTION_CONTEXTS.current) |