...
 
Commits (3)
[bumpversion]
current_version = 1.2.1
current_version = 1.2.2
commit = True
tag = True
......
......@@ -13,7 +13,7 @@ services:
image: rabbitmq:alpine
restart: always
app:
image: sherzinger/fractalis:1.2.1
image: sherzinger/fractalis:1.2.2
volumes:
- ./config/fractalis/config.py:/config.py
- ./config/fractalis/logging.yaml:/logging.yaml
......@@ -27,7 +27,7 @@ services:
- redis
- rabbitmq
worker:
image: sherzinger/fractalis:1.2.1
image: sherzinger/fractalis:1.2.2
volumes:
- ./config/fractalis/config.py:/config.py
- ./config/fractalis/logging.yaml:/logging.yaml
......
from time import sleep
import logging
import requests
from fractalis import app
logger = logging.getLogger(__name__)
def raise_for_status(r):
if r.status_code != requests.codes.ok:
error = f'PIC-SURE API reported an error: [{r.status_code}] {r.text}'
logger.exception(error)
raise RuntimeError(error)
def submit_query(query: str, server: str, token: str) -> int:
r = requests.post(
url='{}/queryService/runQuery'.format(server),
......@@ -15,14 +26,14 @@ def submit_query(query: str, server: str, token: str) -> int:
},
verify=app.config['ETL_VERIFY_SSL_CERT']
)
r.raise_for_status()
raise_for_status(r)
result_id = r.json()['resultId']
return result_id
def wait_for_completion(result_id: int, server, token):
def _check_status():
return requests.get(
r = requests.get(
url='{}/resultService/resultStatus/{}'.format(
server, result_id),
headers={
......@@ -30,9 +41,24 @@ def wait_for_completion(result_id: int, server, token):
'Authorization': 'Bearer {}'.format(token)
},
verify=app.config['ETL_VERIFY_SSL_CERT']
).json()
while _check_status()['status'] == 'RUNNING':
sleep(1)
)
raise_for_status(r)
# noinspection PyBroadException
try:
return r.json()['status']
except Exception:
return r.text
while True:
status = _check_status()
if status == 'RUNNING':
sleep(1)
continue
elif status == 'AVAILABLE':
break
else:
error = f'PIC-SURE API reported an error: {status}'
logger.exception(error)
raise RuntimeError(error)
def get_data(result_id, server, token):
......@@ -45,5 +71,9 @@ def get_data(result_id, server, token):
},
verify=app.config['ETL_VERIFY_SSL_CERT']
)
r.raise_for_status()
raise_for_status(r)
if not r.text:
error = f'PIC-SURE API returned no data.'
logger.exception(error)
raise RuntimeError(error)
return r.text
......@@ -15,7 +15,7 @@ logger = logging.getLogger(__name__)
@misc_blueprint.route('/version', methods=['GET'])
def get_version() -> Tuple[Response, int]:
version = '1.2.1'
version = '1.2.2'
# this is a good place to launch the janitor because /version is one of the
# first requests sent by the front-end on initialization
janitor.delay()
......
amqp==2.2.2
atomicwrites==1.1.5
attrs==18.1.0
billiard==3.5.0.3
celery==4.1.0
certifi==2018.4.16
chardet==3.0.4
click==6.7
cookies==2.2.1
coverage==4.5.1
cycler==0.10.0
flake8==3.5.0
Flask==0.12.2
Flask-Compress==1.4.0
Flask-Cors==3.0.3
flask-request-id-middleware==1.1
Flask-Script==2.0.6
fractalis==0.6.0
idna==2.6
itsdangerous==0.24
Jinja2==2.10
jsonschema==2.6.0
kiwisolver==1.0.1
kombu==4.1.0
lifelines==0.14.3
MarkupSafe==1.0
matplotlib==2.2.2
mccabe==0.6.1
more-itertools==4.2.0
numpy==1.13.3
pandas==0.20.3
piptree==0.1.3
pkginfo==1.4.2
pluggy==0.6.0
py==1.5.3
pycodestyle==2.3.1
pycryptodomex==3.4.7
pyflakes==1.6.0
pyparsing==2.2.0
pytest==3.6.0
pytest-cov==2.5.1
pytest-runner==4.2
python-dateutil==2.7.3
pytz==2018.4
PyYAML==3.12
redis==2.10.6
requests==2.18.4
requests-toolbelt==0.8.0
responses==0.9.0
rpy2==2.9.3
scikit-learn==0.19.1
scipy==0.19.1
six==1.11.0
tqdm==4.23.4
twine==1.11.0
typing==3.6.2
tzlocal==1.5.1
urllib3==1.22
vine==1.1.4
Werkzeug==0.14.1
......@@ -9,10 +9,10 @@ setup(
author='Sascha Herzinger',
author_email='sascha.herzinger@uni.lu',
url='https://git-r3lab.uni.lu/Fractalis/fractalis',
version='1.2.1',
version='1.2.2',
license='Apache2.0',
include_package_data=True,
python_requires='>=3.4.0',
python_requires='>=3.6.0',
install_requires=[
'Flask==0.12.2',
'flask-cors==3.0.3',
......