Commit c1749f6e authored by Sascha Herzinger's avatar Sascha Herzinger
Browse files

Making project compatible with python 3.4

parent 466db455
......@@ -55,7 +55,10 @@ def cleanup_all() -> None:
for key in redis.keys('data:*'):
value = redis.get(key)
data_state = json.loads(value)
celery.AsyncResult(data_state['task_id']).get(propagate=False)
try:
celery.AsyncResult(data_state.get('task_id')).get(propagate=False)
except ValueError:
pass
# celery.control.revoke(data_state['task_id'], terminate=True,
# signal='SIGUSR1', wait=True)
redis.flushall()
......
import os
import glob
import inspect
import importlib
from pathlib import Path
from typing import List
from importlib.machinery import SourceFileLoader
def import_module_by_abs_path(module_path: str) -> object:
......@@ -11,10 +12,7 @@ def import_module_by_abs_path(module_path: str) -> object:
:return: A reference to the imported module.
"""
module_name = os.path.splitext(os.path.basename(module_path))[0]
spec = importlib.util.spec_from_file_location(module_name, module_path)
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
return module
return SourceFileLoader(module_name, module_path).load_module()
def list_classes_with_base_class(
......@@ -28,8 +26,8 @@ def list_classes_with_base_class(
package = importlib.import_module(package)
abs_path = os.path.dirname(os.path.abspath(package.__file__))
class_list = []
for module_path in glob.iglob('{}/*/**/*.py'.format(abs_path),
recursive=True):
for f in Path(abs_path).glob('*/**/*.py'):
module_path = str(f)
if not os.path.basename(module_path).startswith('_'):
module = import_module_by_abs_path(module_path)
classes = inspect.getmembers(module, inspect.isclass)
......
......@@ -8,29 +8,30 @@ setup(
packages=find_packages(),
include_package_data=True,
install_requires=[
'Flask',
'flask-cors',
'Flask-Script',
'flask-request-id-middleware',
'flask-compress',
'jsonschema',
'celery[redis]',
'redis',
'pandas',
'numpy',
'scipy',
'sklearn',
'requests',
'PyYAML',
'pycryptodomex',
'rpy2'
'Flask==0.12.2',
'flask-cors==3.0.3',
'Flask-Script==2.0.6',
'flask-request-id-middleware==1.1',
'flask-compress==1.4.0',
'typing==3.6.2',
'jsonschema==2.6.0',
'celery[redis]==4.1.0',
'redis==2.10.6',
'numpy==1.13.3',
'scipy==0.19.1',
'pandas==0.20.3',
'sklearn==0.0',
'requests==2.18.4',
'PyYAML==3.12',
'pycryptodomex==3.4.7',
'rpy2==2.9.0'
],
setup_requires=[
'pytest-runner',
'pytest-runner==2.12.1',
],
tests_require=[
'pytest==3.0.3',
'pytest-mock',
'responses'
'pytest-mock==1.6.3',
'responses==0.8.1'
]
)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment