From 8912c5061706487a9ec7c2d729714e964ab44ecf Mon Sep 17 00:00:00 2001 From: oliver Date: Thu, 10 Oct 2024 10:55:44 +0200 Subject: [PATCH] 0.0.70 --- .github/workflows/gh_release.yml | 4 +- .../requirements-lucit_ubdcc_dcn.txt | 2 +- .../requirements-lucit_ubdcc_mgmt.txt | 2 +- .../requirements-lucit_ubdcc_restapi.txt | 2 +- dev/_todo.txt | 1 + dev/docker/lucit-ubdcc-dcn-latest.sh | 2 +- dev/docker/lucit-ubdcc-dcn.sh | 2 +- dev/docker/lucit-ubdcc-mgmt-latest.sh | 2 +- dev/docker/lucit-ubdcc-mgmt.sh | 2 +- dev/docker/lucit-ubdcc-restapi-latest.sh | 2 +- dev/docker/lucit-ubdcc-restapi.sh | 2 +- dev/set_version_config.yml | 2 +- packages/lucit-ubdcc-dcn/pyproject.toml | 4 +- packages/lucit-ubdcc-dcn/requirements.txt | 2 +- packages/lucit-ubdcc-dcn/setup.py | 4 +- .../lucit_ubdcc_mgmt/RestEndpoints.py | 1 - packages/lucit-ubdcc-mgmt/pyproject.toml | 4 +- packages/lucit-ubdcc-mgmt/requirements.txt | 2 +- packages/lucit-ubdcc-mgmt/setup.py | 4 +- .../lucit_ubdcc_restapi/RestEndpoints.py | 64 +++++++++++-------- packages/lucit-ubdcc-restapi/pyproject.toml | 4 +- packages/lucit-ubdcc-restapi/requirements.txt | 2 +- packages/lucit-ubdcc-restapi/setup.py | 4 +- .../lucit_ubdcc_shared_modules/App.py | 20 +++--- .../lucit-ubdcc-shared-modules/pyproject.toml | 2 +- packages/lucit-ubdcc-shared-modules/setup.py | 2 +- 26 files changed, 77 insertions(+), 67 deletions(-) diff --git a/.github/workflows/gh_release.yml b/.github/workflows/gh_release.yml index 8eb156c..f688dbf 100644 --- a/.github/workflows/gh_release.yml +++ b/.github/workflows/gh_release.yml @@ -16,8 +16,8 @@ jobs: - name: Create GitHub Release uses: softprops/action-gh-release@v1 with: - tag_name: 0.0.68 - name: Release 0.0.68 + tag_name: 0.0.70 + name: Release 0.0.70 body: | Please read the [CHANGELOG](https://unicorn-binance-depthcache-cluster.docs.lucit.tech/changelog.html) for further information. draft: false diff --git a/container/generic_loader/requirements-lucit_ubdcc_dcn.txt b/container/generic_loader/requirements-lucit_ubdcc_dcn.txt index 0fa4c49..73a250d 100644 --- a/container/generic_loader/requirements-lucit_ubdcc_dcn.txt +++ b/container/generic_loader/requirements-lucit_ubdcc_dcn.txt @@ -1,2 +1,2 @@ -lucit-ubdcc-dcn==0.0.68 +lucit-ubdcc-dcn==0.0.70 unicorn_binance_local_depth_cache>=2.1.1 \ No newline at end of file diff --git a/container/generic_loader/requirements-lucit_ubdcc_mgmt.txt b/container/generic_loader/requirements-lucit_ubdcc_mgmt.txt index d280135..400d208 100644 --- a/container/generic_loader/requirements-lucit_ubdcc_mgmt.txt +++ b/container/generic_loader/requirements-lucit_ubdcc_mgmt.txt @@ -1 +1 @@ -lucit-ubdcc-mgmt==0.0.68 \ No newline at end of file +lucit-ubdcc-mgmt==0.0.70 \ No newline at end of file diff --git a/container/generic_loader/requirements-lucit_ubdcc_restapi.txt b/container/generic_loader/requirements-lucit_ubdcc_restapi.txt index 7675e77..3bf59a6 100644 --- a/container/generic_loader/requirements-lucit_ubdcc_restapi.txt +++ b/container/generic_loader/requirements-lucit_ubdcc_restapi.txt @@ -1 +1 @@ -lucit-ubdcc-restapi==0.0.68 \ No newline at end of file +lucit-ubdcc-restapi==0.0.70 \ No newline at end of file diff --git a/dev/_todo.txt b/dev/_todo.txt index 4d0b423..17e75ae 100644 --- a/dev/_todo.txt +++ b/dev/_todo.txt @@ -6,6 +6,7 @@ Todo: 2. Manchmal wird lizenz als invalid angezeigt +3. JSON ersatz? self._set_update_timestamp() kontrolle in DB bei write sachen diff --git a/dev/docker/lucit-ubdcc-dcn-latest.sh b/dev/docker/lucit-ubdcc-dcn-latest.sh index eb88dee..c93d80a 100755 --- a/dev/docker/lucit-ubdcc-dcn-latest.sh +++ b/dev/docker/lucit-ubdcc-dcn-latest.sh @@ -2,7 +2,7 @@ set -e -VERSION="0.0.68-latest" +VERSION="0.0.70-latest" echo Deploying UBDCC DepthCacheCluster $VERSION to https://i018oau9.c1.de1.container-registry.ovh.net/harbor/projects/3/repositories diff --git a/dev/docker/lucit-ubdcc-dcn.sh b/dev/docker/lucit-ubdcc-dcn.sh index e93820d..f0ff95a 100755 --- a/dev/docker/lucit-ubdcc-dcn.sh +++ b/dev/docker/lucit-ubdcc-dcn.sh @@ -2,7 +2,7 @@ set -e -VERSION="0.0.68" +VERSION="0.0.70" echo Deploying UBDCC DepthCacheCluster $VERSION to https://i018oau9.c1.de1.container-registry.ovh.net/harbor/projects/3/repositories diff --git a/dev/docker/lucit-ubdcc-mgmt-latest.sh b/dev/docker/lucit-ubdcc-mgmt-latest.sh index db229de..643ebfd 100755 --- a/dev/docker/lucit-ubdcc-mgmt-latest.sh +++ b/dev/docker/lucit-ubdcc-mgmt-latest.sh @@ -2,7 +2,7 @@ set -e -VERSION="0.0.68-latest" +VERSION="0.0.70-latest" echo Deploying UBDCC Mgmt $VERSION to https://i018oau9.c1.de1.container-registry.ovh.net/harbor/projects/3/repositories diff --git a/dev/docker/lucit-ubdcc-mgmt.sh b/dev/docker/lucit-ubdcc-mgmt.sh index 292b6b1..0cb7fe8 100755 --- a/dev/docker/lucit-ubdcc-mgmt.sh +++ b/dev/docker/lucit-ubdcc-mgmt.sh @@ -2,7 +2,7 @@ set -e -VERSION="0.0.68" +VERSION="0.0.70" echo Deploying UBDCC Mgmt $VERSION to https://i018oau9.c1.de1.container-registry.ovh.net/harbor/projects/3/repositories diff --git a/dev/docker/lucit-ubdcc-restapi-latest.sh b/dev/docker/lucit-ubdcc-restapi-latest.sh index 321f44b..e0bd4c1 100755 --- a/dev/docker/lucit-ubdcc-restapi-latest.sh +++ b/dev/docker/lucit-ubdcc-restapi-latest.sh @@ -2,7 +2,7 @@ set -e -VERSION="0.0.68-latest" +VERSION="0.0.70-latest" echo Deploying UBDCC RESTAPI $VERSION to https://i018oau9.c1.de1.container-registry.ovh.net/harbor/projects/3/repositories diff --git a/dev/docker/lucit-ubdcc-restapi.sh b/dev/docker/lucit-ubdcc-restapi.sh index a32972e..1dc4401 100755 --- a/dev/docker/lucit-ubdcc-restapi.sh +++ b/dev/docker/lucit-ubdcc-restapi.sh @@ -2,7 +2,7 @@ set -e -VERSION="0.0.68" +VERSION="0.0.70" echo Deploying UBDCC RESTAPI $VERSION to https://i018oau9.c1.de1.container-registry.ovh.net/harbor/projects/3/repositories diff --git a/dev/set_version_config.yml b/dev/set_version_config.yml index 4ac6f4c..89cb1cd 100644 --- a/dev/set_version_config.yml +++ b/dev/set_version_config.yml @@ -23,4 +23,4 @@ files: - packages/lucit-ubdcc-shared-modules/lucit_ubdcc_shared_modules/App.py - packages/lucit-ubdcc-shared-modules/pyproject.toml - packages/lucit-ubdcc-shared-modules/setup.py -version: 0.0.68 +version: 0.0.70 diff --git a/packages/lucit-ubdcc-dcn/pyproject.toml b/packages/lucit-ubdcc-dcn/pyproject.toml index c9bad77..34c4381 100644 --- a/packages/lucit-ubdcc-dcn/pyproject.toml +++ b/packages/lucit-ubdcc-dcn/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "lucit-ubdcc-dcn" -version = "0.0.68" +version = "0.0.70" description = "LUCIT UBDCC DepthCacheNode" authors = ["LUCIT Systems and Development "] license = "LSOSL - LUCIT Synergetic Open Source License" @@ -25,7 +25,7 @@ repository = "https://github.com/LUCIT-Systems-and-Development/unicorn-binance-d [tool.poetry.dependencies] python = ">=3.12.0" lucit-licensing-python = ">=1.8.2" -lucit-ubdcc-shared-modules = "==0.0.68" +lucit-ubdcc-shared-modules = "==0.0.70" [tool.poetry.dev-dependencies] diff --git a/packages/lucit-ubdcc-dcn/requirements.txt b/packages/lucit-ubdcc-dcn/requirements.txt index cdd85d3..c17c431 100644 --- a/packages/lucit-ubdcc-dcn/requirements.txt +++ b/packages/lucit-ubdcc-dcn/requirements.txt @@ -1,2 +1,2 @@ -lucit-ubdcc-shared-modules==0.0.68 +lucit-ubdcc-shared-modules==0.0.70 unicorn_binance_local_depth_cache>=2.1.1 diff --git a/packages/lucit-ubdcc-dcn/setup.py b/packages/lucit-ubdcc-dcn/setup.py index 5491018..d18e282 100644 --- a/packages/lucit-ubdcc-dcn/setup.py +++ b/packages/lucit-ubdcc-dcn/setup.py @@ -31,7 +31,7 @@ setup( name=name, - version="0.0.68", + version="0.0.70", author="LUCIT Systems and Development", author_email='info@lucit.tech', url="https://github.com/LUCIT-Systems-and-Development/unicorn-binance-depthcache-cluster", @@ -39,7 +39,7 @@ long_description=long_description, long_description_content_type="text/markdown", license='LSOSL - LUCIT Synergetic Open Source License', - install_requires=['lucit-licensing-python>=1.8.2', 'lucit-ubdcc-shared-modules==0.0.68'], + install_requires=['lucit-licensing-python>=1.8.2', 'lucit-ubdcc-shared-modules==0.0.70'], keywords='', project_urls={ 'Howto': 'https://www.lucit.tech/unicorn-binance-depthcache-cluster.html#howto', diff --git a/packages/lucit-ubdcc-mgmt/lucit_ubdcc_mgmt/RestEndpoints.py b/packages/lucit-ubdcc-mgmt/lucit_ubdcc_mgmt/RestEndpoints.py index 8871117..273fc3f 100644 --- a/packages/lucit-ubdcc-mgmt/lucit_ubdcc_mgmt/RestEndpoints.py +++ b/packages/lucit-ubdcc-mgmt/lucit_ubdcc_mgmt/RestEndpoints.py @@ -199,7 +199,6 @@ async def ubdcc_get_responsible_dcn_addresses(self, request: Request): return self.get_error_response(event=event, error_id="#1012", message="Missing required parameter: exchange, market") result = self.db.get_responsible_dcn_addresses(exchange=exchange, market=market) - print(f"RESULT: {result}") if not result: return self.get_error_response(event=event, error_id="#1013", message=f"No addresses of responsible DCN for '{market}' from '{exchange}' " diff --git a/packages/lucit-ubdcc-mgmt/pyproject.toml b/packages/lucit-ubdcc-mgmt/pyproject.toml index f93c212..e46c413 100644 --- a/packages/lucit-ubdcc-mgmt/pyproject.toml +++ b/packages/lucit-ubdcc-mgmt/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "lucit-ubdcc-mgmt" -version = "0.0.68" +version = "0.0.70" description = "LUCIT UBDCC Mgmt Service" authors = ["LUCIT Systems and Development "] license = "LSOSL - LUCIT Synergetic Open Source License" @@ -25,7 +25,7 @@ repository = "https://github.com/LUCIT-Systems-and-Development/unicorn-binance-d [tool.poetry.dependencies] python = ">=3.12.0" lucit-licensing-python = ">=1.8.2" -lucit-ubdcc-shared-modules = "==0.0.68" +lucit-ubdcc-shared-modules = "==0.0.70" [tool.poetry.dev-dependencies] diff --git a/packages/lucit-ubdcc-mgmt/requirements.txt b/packages/lucit-ubdcc-mgmt/requirements.txt index af35736..65f3b71 100644 --- a/packages/lucit-ubdcc-mgmt/requirements.txt +++ b/packages/lucit-ubdcc-mgmt/requirements.txt @@ -1 +1 @@ -lucit-ubdcc-shared-modules==0.0.68 \ No newline at end of file +lucit-ubdcc-shared-modules==0.0.70 \ No newline at end of file diff --git a/packages/lucit-ubdcc-mgmt/setup.py b/packages/lucit-ubdcc-mgmt/setup.py index 2c0fcd1..8b56edb 100644 --- a/packages/lucit-ubdcc-mgmt/setup.py +++ b/packages/lucit-ubdcc-mgmt/setup.py @@ -31,7 +31,7 @@ setup( name=name, - version="0.0.68", + version="0.0.70", author="LUCIT Systems and Development", author_email='info@lucit.tech', url="https://github.com/LUCIT-Systems-and-Development/unicorn-binance-depthcache-cluster", @@ -39,7 +39,7 @@ long_description=long_description, long_description_content_type="text/markdown", license='LSOSL - LUCIT Synergetic Open Source License', - install_requires=['lucit-licensing-python>=1.8.2', 'lucit-ubdcc-shared-modules==0.0.68'], + install_requires=['lucit-licensing-python>=1.8.2', 'lucit-ubdcc-shared-modules==0.0.70'], keywords='', project_urls={ 'Howto': 'https://www.lucit.tech/unicorn-binance-depthcache-cluster.html#howto', diff --git a/packages/lucit-ubdcc-restapi/lucit_ubdcc_restapi/RestEndpoints.py b/packages/lucit-ubdcc-restapi/lucit_ubdcc_restapi/RestEndpoints.py index 5b4a6ab..dc24cdb 100644 --- a/packages/lucit-ubdcc-restapi/lucit_ubdcc_restapi/RestEndpoints.py +++ b/packages/lucit-ubdcc-restapi/lucit_ubdcc_restapi/RestEndpoints.py @@ -17,6 +17,7 @@ # # Copyright (c) 2024-2024, LUCIT Systems and Development (https://www.lucit.tech) # All rights reserved. +import json from lucit_ubdcc_shared_modules.RestEndpointsBase import RestEndpointsBase, Request @@ -87,33 +88,12 @@ async def create_depthcache(self, request: Request): async def get_asks(self, request: Request): event = "GET_ASKS" endpoint = "/get_asks" - exchange = request.query_params.get("exchange") - market = request.query_params.get("market") - addresses = await self.app.ubdcc_get_responsible_dcn_addresses(exchange=exchange, market=market) - print(f"addis: {addresses}") + return await self.get_depthcache_data(request=request, event=event, endpoint=endpoint) - # Todo:! - limit_count = request.query_params.get("limit_count") - threshold_volume = request.query_params.get("threshold_volume") - query = (f"?exchange={exchange}&" - f"market={market}") - url = addresses + endpoint + query - result = self.app.request(url=url, method="get") - if result.get('error') is None and result.get('error_id') is None: - return result - elif result.get('error_id') is not None: - return self.get_error_response(event=event, error_id=result.get('error_id'), message=result.get('message')) - else: - response = self.create_cluster_info_response() - response['error'] = str(result) - if self.app.data.get('db') is None: - return self.get_error_response(event=event, error_id="#9000", message=f"Mgmt service not available!", - params=response) - else: - return self.get_error_response(event=event, error_id="#8000", - message=f"Mgmt service not available! This is cached data from pod " - f"'{self.app.id['uid']}'!", - params=response) + async def get_bids(self, request: Request): + event = "GET_BIDS" + endpoint = "/get_bids" + return await self.get_depthcache_data(request=request, event=event, endpoint=endpoint) async def get_cluster_info(self, request: Request): event = "GET_CLUSTER_INFO" @@ -137,6 +117,38 @@ async def get_cluster_info(self, request: Request): f"'{self.app.id['uid']}'!", params=response) + async def get_depthcache_data(self, request: Request, event=None, endpoint=None): + exchange = request.query_params.get("exchange") + market = request.query_params.get("market") + responsible_dcn = await self.app.ubdcc_get_responsible_dcn_addresses(exchange=exchange, market=market) + limit_count = request.query_params.get("limit_count") + threshold_volume = request.query_params.get("threshold_volume") + if responsible_dcn is None: + if not exchange or not market: + return self.get_error_response(event=event, error_id="#1025", + message="Missing required parameter: exchange, market") + addresses = self.app.data['db'].get_responsible_dcn_addresses(exchange=exchange, market=market) + else: + addresses = responsible_dcn['addresses'] + if len(addresses) == 0: + return self.get_error_response(event=event, error_id="#4000", + message=f"No DCN found for '{market}' on '{exchange}'!") + query = (f"?exchange={exchange}&" + f"market={market}&" + f"limit_count={limit_count}&" + f"threshold_volume={threshold_volume}") + result_errors = [] + for address, port in addresses: + self.app.stdout_msg(f"Connecting http://{address}:{port}/{endpoint}{query} ...") + url = f"http://{address}:{port}" + endpoint + query + result = self.app.request(url=url, method="get") + if result.get('error') is None and result.get('error_id') is None: + return result + result_errors.append([address, port, str(result)]) + self.app.stdout_msg(f"No DCN has responded to the requests: {result_errors}") + return self.get_error_response(event=event, error_id="#5000", message=f"No DCN has responded to the requests!", + params={"requests": result_errors}) + async def get_depthcache_list(self, request: Request): event = "GET_DEPTHCACHE_LIST" endpoint = "/get_depthcache_list" diff --git a/packages/lucit-ubdcc-restapi/pyproject.toml b/packages/lucit-ubdcc-restapi/pyproject.toml index 2927798..66d35ff 100644 --- a/packages/lucit-ubdcc-restapi/pyproject.toml +++ b/packages/lucit-ubdcc-restapi/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "lucit-ubdcc-restapi" -version = "0.0.68" +version = "0.0.70" description = "LUCIT UBDCC REST API" authors = ["LUCIT Systems and Development "] license = "LSOSL - LUCIT Synergetic Open Source License" @@ -25,7 +25,7 @@ repository = "https://github.com/LUCIT-Systems-and-Development/unicorn-binance-d [tool.poetry.dependencies] python = ">=3.12.0" lucit-licensing-python = ">=1.8.2" -lucit-ubdcc-shared-modules = "==0.0.68" +lucit-ubdcc-shared-modules = "==0.0.70" [tool.poetry.dev-dependencies] diff --git a/packages/lucit-ubdcc-restapi/requirements.txt b/packages/lucit-ubdcc-restapi/requirements.txt index af35736..65f3b71 100644 --- a/packages/lucit-ubdcc-restapi/requirements.txt +++ b/packages/lucit-ubdcc-restapi/requirements.txt @@ -1 +1 @@ -lucit-ubdcc-shared-modules==0.0.68 \ No newline at end of file +lucit-ubdcc-shared-modules==0.0.70 \ No newline at end of file diff --git a/packages/lucit-ubdcc-restapi/setup.py b/packages/lucit-ubdcc-restapi/setup.py index 58ea20c..4da97dd 100644 --- a/packages/lucit-ubdcc-restapi/setup.py +++ b/packages/lucit-ubdcc-restapi/setup.py @@ -31,7 +31,7 @@ setup( name=name, - version="0.0.68", + version="0.0.70", author="LUCIT Systems and Development", author_email='info@lucit.tech', url="https://github.com/LUCIT-Systems-and-Development/unicorn-binance-depthcache-cluster", @@ -39,7 +39,7 @@ long_description=long_description, long_description_content_type="text/markdown", license='LSOSL - LUCIT Synergetic Open Source License', - install_requires=['lucit-licensing-python>=1.8.2', 'lucit-ubdcc-shared-modules==0.0.68'], + install_requires=['lucit-licensing-python>=1.8.2', 'lucit-ubdcc-shared-modules==0.0.70'], keywords='', project_urls={ 'Howto': 'https://www.lucit.tech/unicorn-binance-depthcache-cluster.html#howto', diff --git a/packages/lucit-ubdcc-shared-modules/lucit_ubdcc_shared_modules/App.py b/packages/lucit-ubdcc-shared-modules/lucit_ubdcc_shared_modules/App.py index e336fe6..20dd432 100644 --- a/packages/lucit-ubdcc-shared-modules/lucit_ubdcc_shared_modules/App.py +++ b/packages/lucit-ubdcc-shared-modules/lucit_ubdcc_shared_modules/App.py @@ -42,7 +42,7 @@ REST_SERVER_PORT_DEV_DCN: int = 42082 REST_SERVER_PORT_DEV_MGMT: int = 42080 REST_SERVER_PORT_DEV_RESTAPI: int = 42081 -VERSION: str = "0.0.68" +VERSION: str = "0.0.70" class App: @@ -439,16 +439,14 @@ async def ubdcc_get_responsible_dcn_addresses(self, query = (f"?exchange={exchange}&" f"market={market}") url = host + endpoint + query - while self.is_shutdown() is False: - result = self.request(url=url, method="get") - if result.get('error_id') is None and result.get('error') is None: - self.stdout_msg(f"Successfully caught responsible DCN addresses for {market} on {exchange}!", - log="info") - return result - else: - self.stdout_msg(f"Can not catch responsible DCN addresses: {result}", log="error") - await asyncio.sleep(3) - return None + result = self.request(url=url, method="get") + if result.get('error_id') is None and result.get('error') is None: + self.stdout_msg(f"Successfully caught responsible DCN addresses for {market} on {exchange}!", + log="info") + return result + else: + self.stdout_msg(f"Can not catch responsible DCN addresses: {result}", log="error") + return None def ubdcc_node_cancellation(self): self.stdout_msg(f"Cancel node registration ...", log="info") diff --git a/packages/lucit-ubdcc-shared-modules/pyproject.toml b/packages/lucit-ubdcc-shared-modules/pyproject.toml index 92d8b30..d0a202e 100644 --- a/packages/lucit-ubdcc-shared-modules/pyproject.toml +++ b/packages/lucit-ubdcc-shared-modules/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "lucit-ubdcc-shared-modules" -version = "0.0.68" +version = "0.0.70" description = "LUCIT UBDCC Shared Modules" authors = ["LUCIT Systems and Development "] license = "LSOSL - LUCIT Synergetic Open Source License" diff --git a/packages/lucit-ubdcc-shared-modules/setup.py b/packages/lucit-ubdcc-shared-modules/setup.py index fe14be5..d6d5f26 100644 --- a/packages/lucit-ubdcc-shared-modules/setup.py +++ b/packages/lucit-ubdcc-shared-modules/setup.py @@ -31,7 +31,7 @@ setup( name=name, - version="0.0.68", + version="0.0.70", author="LUCIT Systems and Development", author_email='info@lucit.tech', url="https://github.com/LUCIT-Systems-and-Development/unicorn-binance-depthcache-cluster",