Skip to content

Commit

Permalink
Upgrade python deps to those present in Ubuntu 16.04
Browse files Browse the repository at this point in the history
  • Loading branch information
stefano-maggiolo committed Mar 21, 2017
1 parent dc19ea2 commit 37c6120
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 39 deletions.
7 changes: 7 additions & 0 deletions cms/db/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
from __future__ import print_function
from __future__ import unicode_literals

import logging
import psycopg2

from sqlalchemy.orm import sessionmaker, scoped_session
Expand All @@ -41,6 +42,9 @@
from . import engine


logger = logging.getLogger(__name__)


Session = sessionmaker(engine, twophase=config.twophase_commit)
ScopedSession = scoped_session(Session)

Expand Down Expand Up @@ -92,6 +96,9 @@ def custom_psycopg2_connection(**kwargs):
database_url = make_url(config.database)
assert database_url.get_dialect().driver == "psycopg2"
database_url.query.update(kwargs)
if database_url.port is None:
database_url.port = 5432
logger.warning("Using default port 5432 for Postgres DB")

return psycopg2.connect(
host=database_url.host,
Expand Down
6 changes: 3 additions & 3 deletions cms/io/rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
from weakref import WeakSet

import gevent
import gevent.coros
import gevent.lock
import gevent.socket
import gevent.event

Expand Down Expand Up @@ -99,8 +99,8 @@ def __init__(self, remote_address):
self._reader = None
self._writer = None

self._read_lock = gevent.coros.RLock()
self._write_lock = gevent.coros.RLock()
self._read_lock = gevent.lock.RLock()
self._write_lock = gevent.lock.RLock()

def add_on_connect_handler(self, handler):
"""Register a callback for connection establishment.
Expand Down
8 changes: 4 additions & 4 deletions cms/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
import logging
import sys

import gevent.coros
import gevent.lock

from cmscommon.terminal import colors, add_color_to_string, has_color_support

Expand All @@ -67,7 +67,7 @@ def createLock(self):
"""Set self.lock to a new gevent RLock.
"""
self.lock = gevent.coros.RLock()
self.lock = gevent.lock.RLock()


class FileHandler(logging.FileHandler):
Expand All @@ -81,7 +81,7 @@ def createLock(self):
"""Set self.lock to a new gevent RLock.
"""
self.lock = gevent.coros.RLock()
self.lock = gevent.lock.RLock()


class LogServiceHandler(logging.Handler):
Expand Down Expand Up @@ -119,7 +119,7 @@ def createLock(self):
"""Set self.lock to a new gevent RLock.
"""
self.lock = gevent.coros.RLock()
self.lock = gevent.lock.RLock()

# Taken from CPython, combining emit and makePickle, and adapted to
# not pickle the dictionary and use its items as keyword parameters
Expand Down
6 changes: 3 additions & 3 deletions cms/service/EvaluationService.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
from datetime import timedelta
from functools import wraps

import gevent.coros
import gevent.lock

from sqlalchemy.exc import IntegrityError
from sqlalchemy.orm import joinedload
Expand Down Expand Up @@ -86,7 +86,7 @@ def __init__(self, evaluation_service):
self._currently_executing = []

# Lock used to guard the currently executing operations
self._current_execution_lock = gevent.coros.RLock()
self._current_execution_lock = gevent.lock.RLock()

# Whether execute need to drop the currently executing
# operation.
Expand Down Expand Up @@ -260,7 +260,7 @@ def __init__(self, shard, contest_id=None):
# invalidate_submission, enqueue) are not executed
# concurrently with action_finished to avoid picking
# operations in state 4.
self.post_finish_lock = gevent.coros.RLock()
self.post_finish_lock = gevent.lock.RLock()

self.scoring_service = self.connect_to(
ServiceCoord("ScoringService", 0))
Expand Down
4 changes: 2 additions & 2 deletions cms/service/Worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import logging
import time

import gevent.coros
import gevent.lock

from cms.io import Service, rpc_method
from cms.db import SessionGen, Contest
Expand Down Expand Up @@ -60,7 +60,7 @@ def __init__(self, shard, fake_worker_time=None):
Service.__init__(self, shard)
self.file_cacher = FileCacher(self)

self.work_lock = gevent.coros.RLock()
self.work_lock = gevent.lock.RLock()
self._last_end_time = None
self._total_free_time = 0
self._total_busy_time = 0
Expand Down
6 changes: 1 addition & 5 deletions cms/service/flushingdict.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,7 @@
import logging

from datetime import datetime, timedelta

try:
from gevent.locks import RLock
except ImportError:
from gevent.coros import RLock
from gevent.lock import RLock


logger = logging.getLogger(__name__)
Expand Down
4 changes: 2 additions & 2 deletions cms/service/workerpool.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

from datetime import timedelta

import gevent.coros
import gevent.lock

from gevent.event import Event

Expand Down Expand Up @@ -100,7 +100,7 @@ def __init__(self, service):

# A lock to ensure that the reverse lookup stays in sync with
# the operations lists.
self._operation_lock = gevent.coros.RLock()
self._operation_lock = gevent.lock.RLock()

# Event set when there are workers available to take jobs. It
# is only guaranteed that if a worker is available, then this
Expand Down
6 changes: 3 additions & 3 deletions cmsranking/Logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import time
from traceback import format_tb

import gevent.coros
import gevent.lock


class StreamHandler(logging.StreamHandler):
Expand All @@ -42,7 +42,7 @@ def createLock(self):
"""Set self.lock to a new gevent RLock.
"""
self.lock = gevent.coros.RLock()
self.lock = gevent.lock.RLock()


class FileHandler(logging.FileHandler):
Expand All @@ -56,7 +56,7 @@ def createLock(self):
"""Set self.lock to a new gevent RLock.
"""
self.lock = gevent.coros.RLock()
self.lock = gevent.lock.RLock()


def has_color_support(stream):
Expand Down
34 changes: 17 additions & 17 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
tornado==4.1
psycopg2==2.6
sqlalchemy>=0.9,<1.1
netifaces==0.10.4
pycrypto==2.6.1
pytz==2015.4
psutil>=0.6,<4.3
six==1.9
requests==2.7
gevent==1.0.2
werkzeug==0.10.4
patool==1.7
bcrypt==2.0
chardet==2.3
tornado>=4.2,<4.3 # http://www.tornadoweb.org/en/stable/releases.html
psycopg2>=2.6,<2.7 # http://initd.org/psycopg/articles/tag/release/
sqlalchemy>=1.0,<1.1 # http://docs.sqlalchemy.org/en/latest/changelog/index.html
netifaces>=0.10,<0.11 # https://bitbucket.org/al45tair/netifaces/src/
pycrypto>=2.6,<2.7 # https://github.com/dlitz/pycrypto/blob/master/ChangeLog
pytz>=2014.10,<2014.11 # https://pypi.python.org/pypi/pytz
psutil>=3.4,<3.5 # https://github.com/giampaolo/psutil/blob/master/HISTORY.rst
six>=1.10,<1.11 # https://github.com/benjaminp/six/blob/master/CHANGES
requests>=2.9,<2.10 # https://pypi.python.org/pypi/requests
gevent>=1.1,<1.2 # http://www.gevent.org/changelog.html
werkzeug>=0.10,<0.11 # https://github.com/pallets/werkzeug/blob/master/CHANGES
patool>=1.10,<1.11 # https://github.com/wummel/patool/blob/master/doc/changelog.txt
bcrypt>=2.0,<2.1 # https://github.com/pyca/bcrypt/
chardet>=2.3,<2.4 # https://pypi.python.org/pypi/chardet

# Only for some importers:
pyyaml==3.11
pyyaml>=3.11,<3.12 # http://pyyaml.org/wiki/PyYAML

# Only for printing:
pycups==1.9.72
PyPDF2==1.24
pycups>=1.9,<1.10 # https://pypi.python.org/pypi/pycups
PyPDF2>=1.25,<1.26 # https://github.com/mstamy2/PyPDF2/blob/master/CHANGELOG

0 comments on commit 37c6120

Please sign in to comment.