Commit 2ebbd81a authored by Sascha Herzinger's avatar Sascha Herzinger
Browse files

Moved descriptor to meta data

parent 19788d26
......@@ -3,10 +3,9 @@ image: python:latest
services:
- redis
- rabbitmq
- r-base
- bioconductor/release_base2
before_script:
- apt-get install r-base r-bioc-limma
- pip install -e . --default-timeout=180
- pip install flake8
- export FRACTALIS_CONFIG="$(pwd)/gitlab-config.py"
......
......@@ -111,10 +111,8 @@ class ETL(Task, metaclass=abc.ABCMeta):
features = data_frame.get('feature')
if features:
features = features.unique().tolist()
data_state['meta'] = {
'features': features
}
data_state['loaded'] = True
data_state['meta']['features'] = features
redis.setex(name='data:{}'.format(self.request.id),
value=json.dumps(data_state),
time=app.config['FRACTALIS_CACHE_EXP'])
......
......@@ -87,9 +87,10 @@ class ETLHandler(metaclass=abc.ABCMeta):
'task_id': task_id,
'file_path': file_path,
'label': cls.make_label(descriptor),
'descriptor': descriptor,
'data_type': data_type,
'meta': {},
'meta': {
'descriptor': descriptor,
},
'loaded': False,
}
redis.setex(name='data:{}'.format(task_id),
......
......@@ -158,7 +158,6 @@ class TestData:
data_state = json.loads(value)
assert 'file_path' in data_state
assert 'label' in data_state
assert 'descriptor' in data_state
assert 'data_type' in data_state
assert 'loaded' in data_state
assert 'meta' in data_state
......@@ -173,7 +172,6 @@ class TestData:
data_state = json.loads(value)
assert 'file_path' in data_state
assert 'label' in data_state
assert 'descriptor' in data_state
assert 'data_type' in data_state
assert 'loaded' in data_state
assert 'meta' in data_state
......@@ -235,7 +233,6 @@ class TestData:
assert 'meta' not in data_state
assert data_state['etl_state'] == 'PENDING'
assert not data_state['etl_message']
assert 'descriptor' in data_state
assert data_state['data_type'] == 'something'
assert not data_state['loaded']
assert 'task_id' in data_state
......@@ -249,7 +246,6 @@ class TestData:
assert 'file_path' not in data_state
assert data_state['etl_state'] == 'SUCCESS'
assert not data_state['etl_message']
assert 'descriptor' in data_state
assert data_state['data_type'] == 'something'
assert data_state['loaded']
assert 'task_id' in data_state
......@@ -263,7 +259,6 @@ class TestData:
assert 'file_path' not in data_state
assert data_state['etl_state'] == 'FAILURE'
assert data_state['etl_message']
assert 'descriptor' in data_state
assert data_state['data_type'] == 'something'
assert not data_state['loaded']
assert 'task_id' in data_state
......@@ -350,7 +345,7 @@ class TestData:
rv = test_client.get('/data/meta/{}'.format(data_state['task_id']))
body = flask.json.loads(rv.get_data())
assert rv.status_code == 200
assert not body.get('meta')
assert not 'features' in body['meta']
def test_valid_response_after_loaded_on_meta(self, test_client, payload):
test_client.post('/data?wait=1', data=payload['serialized'])
......@@ -361,7 +356,7 @@ class TestData:
.format(data_state['task_id']))
body = flask.json.loads(rv.get_data())
assert rv.status_code == 200
assert body.get('meta')
assert 'features' in body['meta']
def test_403_if_no_auth_on_get_meta(self, test_client, payload):
test_client.post('/data?wait=1', data=payload['serialized'])
......
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