diff --git a/.travis.yml b/.travis.yml
index bd84faf..863990a 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -12,10 +12,6 @@ services:
- docker
before_install:
- - sudo apt-get -qq update
- - sudo apt-get install zookeeper zookeeperd -y
- - sudo pip install cocaine cocaine-tools
- - docker pull noxiouz/cocaine
- docker run -d --net=host noxiouz/cocaine && docker ps
install:
diff --git a/cocaine/detail/baseservice.py b/cocaine/detail/baseservice.py
index beabc50..e11d0be 100644
--- a/cocaine/detail/baseservice.py
+++ b/cocaine/detail/baseservice.py
@@ -22,6 +22,7 @@
import itertools
import socket
import time
+import warnings
import weakref
import six
@@ -76,6 +77,8 @@ def set_keep_alive(sock, idle=10, interval=5, fails=5):
class BaseService(object):
def __init__(self, name, endpoints, io_loop=None):
+ if io_loop:
+ warnings.warn('io_loop argument is deprecated.', DeprecationWarning)
# If it's not the main thread
# and a current IOloop doesn't exist here,
# IOLoop.instance becomes self._io_loop
diff --git a/cocaine/detail/channel.py b/cocaine/detail/channel.py
index db153b5..3885f1d 100644
--- a/cocaine/detail/channel.py
+++ b/cocaine/detail/channel.py
@@ -20,6 +20,7 @@
import datetime
import logging
+import warnings
import six
@@ -123,6 +124,8 @@ def __init__(self, rx_tree, session_id, header_table=None, io_loop=None, service
if header_table is None:
header_table = CocaineHeaders()
+ if io_loop:
+ warnings.warn('io_loop argument is deprecated.', DeprecationWarning)
# If it's not the main thread
# and a current IOloop doesn't exist here,
# IOLoop.instance becomes self._io_loop
diff --git a/cocaine/detail/iotimer.py b/cocaine/detail/iotimer.py
index ab37782..16bd851 100644
--- a/cocaine/detail/iotimer.py
+++ b/cocaine/detail/iotimer.py
@@ -18,10 +18,14 @@
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see .
#
+import warnings
-from tornado.ioloop import PeriodicCallback
+from tornado.ioloop import IOLoop, PeriodicCallback
class Timer(PeriodicCallback):
- def __init__(self, callback, callback_time, io_loop):
+ def __init__(self, callback, callback_time, io_loop=None):
+ if io_loop:
+ warnings.warn('io_loop argument is deprecated.', DeprecationWarning)
+ io_loop = io_loop or IOLoop.current()
super(Timer, self).__init__(callback, callback_time * 1000, io_loop)
diff --git a/cocaine/detail/locator.py b/cocaine/detail/locator.py
index 9662c16..a1df79f 100644
--- a/cocaine/detail/locator.py
+++ b/cocaine/detail/locator.py
@@ -17,6 +17,7 @@
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see .
#
+import warnings
from .api import API
from .baseservice import BaseService
@@ -27,6 +28,8 @@
class Locator(BaseService):
def __init__(self, endpoints=LOCATOR_DEFAULT_ENDPOINTS, io_loop=None):
+ if io_loop:
+ warnings.warn('io_loop argument is deprecated.', DeprecationWarning)
super(Locator, self).__init__(name="locator",
endpoints=endpoints, io_loop=io_loop)
self.api = API.Locator
diff --git a/cocaine/detail/logger.py b/cocaine/detail/logger.py
index 008f882..cc1ae43 100644
--- a/cocaine/detail/logger.py
+++ b/cocaine/detail/logger.py
@@ -24,6 +24,7 @@
import json
import logging
import threading
+import warnings
import six
from six.moves import cStringIO as BytesIO
@@ -87,6 +88,8 @@ def __new__(cls, *args, **kwargs):
@thread_once
def __init__(self, endpoints=LOCATOR_DEFAULT_ENDPOINTS, io_loop=None):
+ if io_loop:
+ warnings.warn('io_loop argument is deprecated.', DeprecationWarning)
self.io_loop = io_loop or IOLoop.current()
self.endpoints = endpoints
self._lock = Lock()
@@ -268,7 +271,8 @@ def __del__(self):
@coroutine
def resolve_logging(endpoints, name="logging", io_loop=None):
- io_loop = io_loop or IOLoop.current()
+ if io_loop:
+ warnings.warn('io_loop argument is deprecated.', DeprecationWarning)
for host, port in endpoints:
buff = msgpack_unpacker()
@@ -303,7 +307,7 @@ def emit(self, record):
lvl = record.levelno
extra = getattr(record, "extra", {})
if lvl >= logging.ERROR:
- # to avoid message formating
+ # to avoid message formatting
if self._logger.enable_for(ERROR_LEVEL):
self._logger.error(self.format(record), extra=extra)
elif lvl >= logging.WARNING:
diff --git a/cocaine/detail/service.py b/cocaine/detail/service.py
index 1c53c53..018a2b5 100644
--- a/cocaine/detail/service.py
+++ b/cocaine/detail/service.py
@@ -18,6 +18,7 @@
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see .
#
+import warnings
from .baseservice import BaseService
from .defaults import Defaults
@@ -34,6 +35,8 @@
class Service(BaseService):
def __init__(self, name, endpoints=LOCATOR_DEFAULT_ENDPOINT,
seed=None, version=0, locator=None, io_loop=None, timeout=0):
+ if io_loop:
+ warnings.warn('io_loop argument is deprecated.', DeprecationWarning)
super(Service, self).__init__(name=name, endpoints=LOCATOR_DEFAULT_ENDPOINT, io_loop=io_loop)
self.locator_endpoints = endpoints
self.locator = locator
diff --git a/cocaine/futures/__init__.py b/cocaine/futures/__init__.py
index cf5ee13..792c6ff 100644
--- a/cocaine/futures/__init__.py
+++ b/cocaine/futures/__init__.py
@@ -20,6 +20,7 @@
#
import threading
+import warnings
from tornado.concurrent import Future
from tornado.ioloop import IOLoop
@@ -31,6 +32,8 @@
class ConcurrentWorker(object):
def __init__(self, func, io_loop=None, args=(), kwargs=None):
self._func = func
+ if io_loop:
+ warnings.warn('io_loop argument is deprecated.', DeprecationWarning)
self._io_loop = io_loop or IOLoop.current()
self._args = args
self._kwargs = kwargs or {}
@@ -53,5 +56,5 @@ def execute(self):
def threaded(func):
def wrapper(*args, **kwargs):
- return ConcurrentWorker(func, io_loop=None, args=args, kwargs=kwargs).execute()
+ return ConcurrentWorker(func, args=args, kwargs=kwargs).execute()
return wrapper
diff --git a/cocaine/worker/worker.py b/cocaine/worker/worker.py
index fdcfa05..be8df59 100644
--- a/cocaine/worker/worker.py
+++ b/cocaine/worker/worker.py
@@ -20,6 +20,7 @@
#
import logging
import socket
+import warnings
import six
@@ -71,7 +72,10 @@ def token(self):
class TicketVendingMachineTokenManager(TokenManager):
- def __init__(self, name, ticket, interval, loop):
+ def __init__(self, name, ticket, interval, loop=None):
+ if loop:
+ warnings.warn('loop argument is deprecated.', DeprecationWarning)
+ loop = loop or IOLoop.current()
self._name = name
self._ticket = ticket
self._service = Service('tvm')
@@ -100,7 +104,10 @@ def _refresh(self):
yield now
-def make_token_manager(name, token, loop):
+def make_token_manager(name, token, loop=None):
+ if loop:
+ warnings.warn('io_loop argument is deprecated.', DeprecationWarning)
+ loop = loop or IOLoop.current()
if token.ty == 'TVM':
return TicketVendingMachineTokenManager(name, token.body, 10.0, loop)
else:
@@ -111,7 +118,6 @@ class BasicWorker(object):
def __init__(self, disown_timeout=DEFAULT_DISOWN_TIMEOUT,
heartbeat_timeout=DEFAULT_HEARTBEAT_TIMEOUT,
io_loop=None, app=None, uuid=None, endpoint=None):
-
if heartbeat_timeout < disown_timeout:
raise ValueError("heartbeat timeout must be greater than disown")
@@ -119,6 +125,8 @@ def __init__(self, disown_timeout=DEFAULT_DISOWN_TIMEOUT,
self.uuid = uuid or Defaults.uuid
self.endpoint = endpoint or Defaults.endpoint
+ if io_loop:
+ warnings.warn('io_loop argument is deprecated.', DeprecationWarning)
self.io_loop = io_loop or IOLoop.current()
self._token_manager = make_token_manager(
self.appname,
diff --git a/requirements.txt b/requirements.txt
index fb44443..1aa052a 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,3 +1,9 @@
-msgpack-python
-six <= 1.10
-tornado>=4.2
+
+msgpack
+six >= 1.9,<= 1.10
+tornado >=4.2,<5
+
+
+
+
+
diff --git a/tests/runtime.py b/tests/runtime.py
index 6c29c8d..923328e 100644
--- a/tests/runtime.py
+++ b/tests/runtime.py
@@ -42,9 +42,8 @@
class RuntimeMock(tcpserver.TCPServer):
_msgpack_string_encoding = None if sys.version_info[0] == 2 else 'utf8'
- def __init__(self, unixsocket, io_loop=None):
- super(RuntimeMock, self).__init__(io_loop=io_loop or ioloop.IOLoop.current())
- self.io_loop = io_loop or ioloop.IOLoop.current()
+ def __init__(self, unixsocket):
+ super(RuntimeMock, self).__init__()
self.actions = list()
self.counter = 1
self.endpoint = unixsocket
diff --git a/tox.ini b/tox.ini
index fbef17d..4d6a026 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,10 +1,10 @@
[tox]
envlist = flake8,
- py27,
- py34,
- py35,
- py36
- pypy
+ py27,
+ py34,
+ py35,
+ py36,
+ pypy
skip_missing_interpreters = True
@@ -21,16 +21,13 @@ exclude = .tox,.git,build/,examples/,tests/,*.egg/,docs/
[testenv]
-# Install eggs
-install_command = pip install --egg {opts} {packages}
deps = -rtests/requirements.txt
commands = python setup.py nosetests --cover-min-percentage=0
[testenv:flake8]
-install_command = pip install {opts} {packages}
deps = flake8
- flake8-import-order
- flake8-blind-except
- pep8-naming
+ flake8-import-order
+ flake8-blind-except
+ pep8-naming
commands = flake8 {toxinidir}