Commit 7e4529ed authored by Jacek Lebioda's avatar Jacek Lebioda
Browse files

Improving Dockerfile

parent b89e653b
Pipeline #10737 passed with stage
in 1 minute and 5 seconds
......@@ -12,8 +12,7 @@ COPY code/backend/requirements.txt /home/beacon/elixir-beacon/
WORKDIR /home/beacon/elixir-beacon
RUN pip3 install --default-timeout=60 -i https://pypi.lcsb.uni.lu/simple -r requirements.txt
# Build front-end files
COPY code/frontend/* /home/beacon/elixir-beacon/code/frontend/
RUN ls -laR /home/beacon/elixir-beacon/code/frontend
COPY code/frontend/ /home/beacon/elixir-beacon/code/frontend/
WORKDIR /home/beacon/elixir-beacon/code/frontend
RUN yarn install && \
node node_modules/gulp/bin/gulp.js
......
......@@ -30,6 +30,15 @@ class Beacon(object):
info_for_user = self.datasources_manager.update_authorization_info(info, user_groups)
return info_for_user
def shutdown(self, signum, frame):
"""
Closes the opened connections.
Warning - closes only stateful connections, it does nothing to stateless ones.
For the optional parameters, see https://docs.python.org/3.9/library/signal.html#example
"""
logger.debug(' Received SIGINT or SIGTERM signal, disconnecting stateful data sources')
self.datasources_manager.disconnect_data_sources()
def handle_include_dataset_responses(self, response: List[dict], responses, flag: str):
flag = flag.upper()
......
......@@ -21,14 +21,23 @@ class DataSourcesManager:
self.datasets = []
self.declared_connectors = []
self.unparsed_structure = {}
self.connected = False
self.validator = DataSourcesValidator()
def reset(self):
self.disconnect_data_sources()
self.sources = {}
self.data_sources = {}
self.declared_connectors = []
self.unparsed_structure = {}
def disconnect_data_sources(self):
if not self.connected:
return
for data_source in self.data_sources:
data_source.disconnect()
self.connected = False
def load_data_sources_information_from_yaml_file(self, path_to_yaml_file: str):
self.reset()
self.unparsed_structure = load_yaml_file(path_to_yaml_file)
......@@ -47,6 +56,7 @@ class DataSourcesManager:
def initialize_data_sources(self, data_sources: List[dict]):
for data_source in data_sources:
self.initialize_data_source(data_source)
self.connected = True
def initialize_data_source(self, data_source: dict):
new_data_source_id = data_source.get('id')
......
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