Skip to content
Snippets Groups Projects
Commit d1ad3493 authored by Jan Grewe's avatar Jan Grewe
Browse files

update to 7.7.2

parent e8551b07
Branches master
No related tags found
No related merge requests found
FROM python:2
FROM python:3
RUN apt-get update -qq \
&& apt-get install -qqy --no-install-recommends libjpeg-turbo-progs \
&& rm -r /var/lib/apt/lists/*
RUN pip install thumbor==6.7.5 remotecv==2.3.0 opencv-python pycurl redis tc_redis tc_prometheus
RUN pip install thumbor==7.7.2 remotecv==5.1.6 opencv-python pycurl redis tc_redis tc_prometheus
RUN mkdir /etc/thumbor \
&& thumbor-config > /etc/thumbor.conf
ADD remotecv/redis_store.py /usr/local/lib/python2.7/site-packages/remotecv/result_store/redis_store.py
ADD remotecv/https_loader.py /usr/local/lib/python2.7/site-packages/remotecv/https_loader.py
EXPOSE 8888
EXPOSE 8000
ENV PYTHONUNBUFFERED=1
CMD ["/usr/local/bin/thumbor"]
import urllib2
import re
def load_sync(path):
if not re.match(r'^http?', path):
path = 'https://%s' % path
path = urllib2.unquote(path)
return urllib2.urlopen(path).read()
from redis import Redis
from remotecv.utils import logger
from remotecv.result_store import BaseStore
class ResultStore(BaseStore):
WEEK = 604800
redis_instance = None
def __init__(self, config):
if not ResultStore.redis_instance:
ResultStore.redis_instance = Redis(
host=config.redis_host,
port=config.redis_port,
db=config.redis_database,
password=config.redis_password,
)
self.storage = ResultStore.redis_instance
def store(self, key, points):
result = self.serialize(points)
logger.debug("Points found: %s" % result)
redis_key = "thumbor-detector-%s" % key
self.storage.setex(
name=redis_key,
value=result,
time=2 * self.WEEK,
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment