From fbec686dd1008cb51ab9ceb487ea4a198bc80b38 Mon Sep 17 00:00:00 2001 From: Deralden <121487413+Deralden@users.noreply.github.com> Date: Mon, 19 Aug 2024 13:34:42 +0300 Subject: [PATCH 01/16] Github actions implementation (#1833) --- .circleci/config.yml | 71 ------------- .github/workflows/dev.yml | 189 +++++++++++++++++++++++++++++++++++ .github/workflows/master.yml | 189 +++++++++++++++++++++++++++++++++++ README.md | 2 - 4 files changed, 378 insertions(+), 73 deletions(-) delete mode 100644 .circleci/config.yml create mode 100644 .github/workflows/dev.yml create mode 100644 .github/workflows/master.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index ab4191691..000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,71 +0,0 @@ ---- -version: 2 -jobs: - build: - docker: - - image: circleci/python:3.7-node - - image: circleci/mysql:8.0.21 - command: [--default-authentication-plugin=mysql_native_password] - environment: - MYSQL_ROOT_PASSWORD: unittest_pwd - MYSQL_HOST: '%' - MYSQL_DATABASE: unittest_db - MYSQL_USER: unittest_root - MYSQL_PASSWORD: unittest_pwd - working_directory: ~/singnet - steps: - - checkout - - run: - name: Generating checksum for all requirements file - command: | - shasum */requirement*.txt > /tmp/checksum_files_list - sudo chown -R circleci:circleci /usr/local/bin - sudo chown circleci:circleci -R /usr/local/lib/python3.7 - - run: - name: Revert the permissions - command: | - sudo chown root:root -R /usr/local/bin - sudo chown root:root -R /usr/local/lib/python3.7 - - run: - # Our primary container isn't MYSQL so run a sleep command until it's ready. - name: Waiting for MySQL to be ready - command: | - for i in `seq 1 30`; - do - nc -z 127.0.0.1 3306 && echo Success && exit 0 - echo -n . - sleep 1 - done - echo Failed waiting for MySQL && exit 1 - - run: - name: Install dependencies - command: | - for requirement_file in `ls */*/requirement*.txt`;do sudo pip install -r $requirement_file --prefer-binary ;done - for requirement_file in `ls */requirement*.txt`;do sudo pip install -r $requirement_file --prefer-binary ;done - for package_file in `ls */package*.json | cut -d '/' -f1`;do sudo npm install $package_file/;done - - run: - name: Install required packages. - command: | - sudo apt update --allow-releaseinfo-change - sudo apt install unzip -y - wget https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.6.2.2472-linux.zip - unzip sonar-scanner-cli-4.6.2.2472-linux.zip - sudo apt install default-mysql-client - sudo pip install coverage coveralls pytest alembic - mysql -h 127.0.0.1 -u root -punittest_pwd -e "create database registry_unittest_db" - mysql -h 127.0.0.1 -u root -punittest_pwd -e "create database verification_unittest_db" - mysql -h 127.0.0.1 -u root -punittest_pwd -e "GRANT ALL PRIVILEGES ON *.* TO 'unittest_root'@'%';" - export PYTHONPATH=$PWD - for alembic_file in `ls */alembic*.ini | cut -d '/' -f1`;do cd $alembic_file; echo $alembic_file; alembic upgrade head; cd .. ;done - mysql -h 127.0.0.1 -u unittest_root -punittest_pwd unittest_db < orchestrator/testcases/script.sql - - run: - name: Run unit tests and integration test - command: | - PYTHONPATH=$PWD python -m coverage run -m pytest */testcases/integration_testcases/*.py */testcases/unit_testcases/*.py */testcases/unit_testcases/*/*.py */testcases/functional_testcases/*.py - python -m coverage report -m - coverage xml -i - sonar-scanner-4.6.2.2472-linux/bin/sonar-scanner -Dsonar.host.url=https://sonarqube.singularitynet.io -Dsonar.login=${SONAR_TOKEN} $SONAR_SCANNER_OPTS_CUSTOM - - save_cache: - key: dependency-cache-{{ checksum "/tmp/checksum_files_list" }} - paths: - - /usr/local/lib/python3.7/site-packages \ No newline at end of file diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml new file mode 100644 index 000000000..caf40a666 --- /dev/null +++ b/.github/workflows/dev.yml @@ -0,0 +1,189 @@ +name: tests_development +on: + # push: + # branches: [ "development" ] + pull_request: + branches: [ "development" ] + workflow_dispatch: + +jobs: + run_tests_development: + runs-on: ubuntu-latest + # container: node:20-bookworm + services: + mysql: + image: mysql:8.0.21 + env: + MYSQL_ROOT_PASSWORD: unittest_pwd + MYSQL_HOST: '%' + MYSQL_DATABASE: unittest_db + MYSQL_USER: unittest_root + MYSQL_PASSWORD: unittest_pwd + ports: + - 3306:3306 + + steps: + - uses: actions/setup-node@v4 + with: + node-version: 18 + + - uses: actions/setup-python@v5 + with: + python-version: '3.7' + + - name: install pip + run: | + sudo apt update + sudo apt install -y python3-pip netcat-traditional socat iputils-ping + + - name: install packs + run: | + export PIP_BREAK_SYSTEM_PACKAGES=1 + sudo apt update --allow-releaseinfo-change + sudo apt install unzip -y + wget https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.6.2.2472-linux.zip + unzip sonar-scanner-cli-4.6.2.2472-linux.zip + sudo apt install default-mysql-client -y + # pip3 install coverage coveralls pytest alembic + pip3 install pytest setuptools + + - name: clone repo + uses: actions/checkout@v3 + + - name: check db + run: | + for i in `seq 1 30`; + do + nc -z 172.17.0.1 3306 && echo Success && exit 0 + echo -n . + sleep 1 + done + echo Failed waiting for MySQL && exit 1 + + - name: eth_event_listener layers packages test + run: | + pip3 install -r lambda_layers/eth_event_listener/requirements.txt + + - name: install other side packages and layers + run: | + pip3 install -r lambda_layers/web3_and_grpc_libraries/requirements.txt + pip3 install -r lambda_layers/common_python_libraries/requirements.txt + pip3 install -r registry/migration/requirements.txt + + - name: install npm packages + run: | + # export PIP_BREAK_SYSTEM_PACKAGES=1 + # export CFLAGS="-I${PREFIX}/include/python3.11/cpython" + # for requirement_file in `ls */*/requirement*.txt`;do pip3 install -r $requirement_file ;done + # for requirement_file in `ls */requirement*.txt`;do echo "=============$requirement_file=================="; pip3 install -r $requirement_file ;done + # pip3 install -r reqs.txt + for package_file in `ls */package*.json | cut -d '/' -f1`;do npm install $package_file/;done + + - name: create db + run: | + # export PIP_BREAK_SYSTEM_PACKAGES=1 + # socat TCP-LISTEN:3306,fork TCP:mysql:3306 & + # mysql -h 172.17.0.1 -u root -punittest_pwd -e "create database registry_unittest_db" + mysql -h 127.0.0.1 -P 3306 -u root -punittest_pwd -e "create database registry_unittest_db" + mysql -h 127.0.0.1 -P 3306 -u root -punittest_pwd -e "create database verification_unittest_db" + mysql -h 127.0.0.1 -P 3306 -u root -punittest_pwd -e "GRANT ALL PRIVILEGES ON *.* TO 'unittest_root'@'%';" + export PYTHONPATH=$PWD + for alembic_file in `ls */alembic*.ini | cut -d '/' -f1`;do cd $alembic_file; echo $alembic_file; alembic upgrade head; cd .. ;done + mysql -h 127.0.0.1 -P 3306 -u unittest_root -punittest_pwd unittest_db < orchestrator/testcases/script.sql + + - name: common tests + run: | + export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python + export AWS_XRAY_SDK_ENABLED=false + pip3 install -r common/requirements.txt + + - name: dapp_user tests + run: | + export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python + export AWS_XRAY_SDK_ENABLED=false + pip3 install -r dapp_user/requirements.txt + PYTHONPATH=$PWD python3 -m coverage run -m pytest dapp_user/testcases/unit_testcases/*.py dapp_user/testcases/functional_testcases/*.py + + - name: notification tests + run: | + export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python + export AWS_XRAY_SDK_ENABLED=false + pip3 install -r notification/requirements.txt + + - name: payments tests + run: | + export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python + export AWS_XRAY_SDK_ENABLED=false + pip3 install -r payments/requirements.txt + PYTHONPATH=$PWD python3 -m coverage run -m pytest payments/testcases/unit_testcases/*.py + + - name: service_status tests + run: | + export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python + export AWS_XRAY_SDK_ENABLED=false + pip3 install -r service_status/requirements.txt + pip3 install --upgrade protobuf + PYTHONPATH=$PWD python3 -m coverage run -m pytest service_status/testcases/unit_testcases/*.py service_status/testcases/functional_testcases/*.py + + - name: utility tests + run: | + export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python + export AWS_XRAY_SDK_ENABLED=false + pip3 install setuptools==65.5.0 + pip3 install wheel==0.38.0 + pip3 install -r utility/requirements.txt + PYTHONPATH=$PWD python3 -m coverage run -m pytest utility/testcases/functional_testcases/*.py + + - name: contract_api tests + run: | + export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python + export AWS_XRAY_SDK_ENABLED=false + pip3 install -r contract_api/requirements.txt + PYTHONPATH=$PWD python3 -m coverage run -m pytest contract_api/testcases/unit_testcases/*.py contract_api/testcases/unit_testcases/*/*.py contract_api/testcases/functional_testcases/*.py + + - name: event_pubsub tests + run: | + export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python + export AWS_XRAY_SDK_ENABLED=false + pip3 install -r lambda_layers/web3_and_grpc_libraries/requirements.txt + pip3 install -r lambda_layers/common_python_libraries/requirements.txt + pip3 install -r event_pubsub/requirements.txt + PYTHONPATH=$PWD python3 -m coverage run -m pytest event_pubsub/testcases/unit_testcases/*.py + + - name: orchestrator tests + run: | + export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python + export AWS_XRAY_SDK_ENABLED=false + pip3 install -r orchestrator/requirements.txt + PYTHONPATH=$PWD python3 -m coverage run -m pytest orchestrator/testcases/integration_testcases/*.py orchestrator/testcases/unit_testcases/*.py + + - name: registry tests + run: | + export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python + export AWS_XRAY_SDK_ENABLED=false + pip3 install -r lambda_layers/web3_and_grpc_libraries/requirements.txt + pip3 install -r lambda_layers/common_python_libraries/requirements.txt + pip3 install -r registry/migration/requirements.txt + pip3 install -r registry/requirements.txt + PYTHONPATH=$PWD python3 -m coverage run -m pytest registry/testcases/unit_testcases/*.py registry/testcases/functional_testcases/*.py + + - name: signer tests + run: | + export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python + export AWS_XRAY_SDK_ENABLED=false + pip3 install -r signer/requirements.txt + PYTHONPATH=$PWD python3 -m coverage run -m pytest signer/testcases/integration_testcases/*.py + + - name: verification tests + run: | + export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python + export AWS_XRAY_SDK_ENABLED=false + pip3 install -r verification/requirements.txt + PYTHONPATH=$PWD python3 -m coverage run -m pytest verification/testcases/unit_testcases/*.py verification/testcases/functional_testcases/*.py + + - name: wallets tests + run: | + export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python + export AWS_XRAY_SDK_ENABLED=false + pip3 install -r wallets/requirements.txt + PYTHONPATH=$PWD python3 -m coverage run -m pytest wallets/testcases/integration_testcases/*.py wallets/testcases/unit_testcases/*.py diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml new file mode 100644 index 000000000..c77b21cd8 --- /dev/null +++ b/.github/workflows/master.yml @@ -0,0 +1,189 @@ +name: tests_master +on: + # push: + # branches: [ "master" ] + pull_request: + branches: [ "master" ] + workflow_dispatch: + +jobs: + run_tests_master: + runs-on: ubuntu-latest + # container: node:20-bookworm + services: + mysql: + image: mysql:8.0.21 + env: + MYSQL_ROOT_PASSWORD: unittest_pwd + MYSQL_HOST: '%' + MYSQL_DATABASE: unittest_db + MYSQL_USER: unittest_root + MYSQL_PASSWORD: unittest_pwd + ports: + - 3306:3306 + + steps: + - uses: actions/setup-node@v4 + with: + node-version: 18 + + - uses: actions/setup-python@v5 + with: + python-version: '3.7' + + - name: install pip + run: | + sudo apt update + sudo apt install -y python3-pip netcat-traditional socat iputils-ping + + - name: install packs + run: | + export PIP_BREAK_SYSTEM_PACKAGES=1 + sudo apt update --allow-releaseinfo-change + sudo apt install unzip -y + wget https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.6.2.2472-linux.zip + unzip sonar-scanner-cli-4.6.2.2472-linux.zip + sudo apt install default-mysql-client -y + # pip3 install coverage coveralls pytest alembic + pip3 install pytest setuptools + + - name: clone repo + uses: actions/checkout@v3 + + - name: check db + run: | + for i in `seq 1 30`; + do + nc -z 172.17.0.1 3306 && echo Success && exit 0 + echo -n . + sleep 1 + done + echo Failed waiting for MySQL && exit 1 + + - name: eth_event_listener layers packages test + run: | + pip3 install -r lambda_layers/eth_event_listener/requirements.txt + + - name: install other side packages and layers + run: | + pip3 install -r lambda_layers/web3_and_grpc_libraries/requirements.txt + pip3 install -r lambda_layers/common_python_libraries/requirements.txt + pip3 install -r registry/migration/requirements.txt + + - name: install npm packages + run: | + # export PIP_BREAK_SYSTEM_PACKAGES=1 + # export CFLAGS="-I${PREFIX}/include/python3.11/cpython" + # for requirement_file in `ls */*/requirement*.txt`;do pip3 install -r $requirement_file ;done + # for requirement_file in `ls */requirement*.txt`;do echo "=============$requirement_file=================="; pip3 install -r $requirement_file ;done + # pip3 install -r reqs.txt + for package_file in `ls */package*.json | cut -d '/' -f1`;do npm install $package_file/;done + + - name: create db + run: | + # export PIP_BREAK_SYSTEM_PACKAGES=1 + # socat TCP-LISTEN:3306,fork TCP:mysql:3306 & + # mysql -h 172.17.0.1 -u root -punittest_pwd -e "create database registry_unittest_db" + mysql -h 127.0.0.1 -P 3306 -u root -punittest_pwd -e "create database registry_unittest_db" + mysql -h 127.0.0.1 -P 3306 -u root -punittest_pwd -e "create database verification_unittest_db" + mysql -h 127.0.0.1 -P 3306 -u root -punittest_pwd -e "GRANT ALL PRIVILEGES ON *.* TO 'unittest_root'@'%';" + export PYTHONPATH=$PWD + for alembic_file in `ls */alembic*.ini | cut -d '/' -f1`;do cd $alembic_file; echo $alembic_file; alembic upgrade head; cd .. ;done + mysql -h 127.0.0.1 -P 3306 -u unittest_root -punittest_pwd unittest_db < orchestrator/testcases/script.sql + + - name: common tests + run: | + export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python + export AWS_XRAY_SDK_ENABLED=false + pip3 install -r common/requirements.txt + + - name: dapp_user tests + run: | + export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python + export AWS_XRAY_SDK_ENABLED=false + pip3 install -r dapp_user/requirements.txt + PYTHONPATH=$PWD python3 -m coverage run -m pytest dapp_user/testcases/unit_testcases/*.py dapp_user/testcases/functional_testcases/*.py + + - name: notification tests + run: | + export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python + export AWS_XRAY_SDK_ENABLED=false + pip3 install -r notification/requirements.txt + + - name: payments tests + run: | + export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python + export AWS_XRAY_SDK_ENABLED=false + pip3 install -r payments/requirements.txt + PYTHONPATH=$PWD python3 -m coverage run -m pytest payments/testcases/unit_testcases/*.py + + - name: service_status tests + run: | + export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python + export AWS_XRAY_SDK_ENABLED=false + pip3 install -r service_status/requirements.txt + pip3 install --upgrade protobuf + PYTHONPATH=$PWD python3 -m coverage run -m pytest service_status/testcases/unit_testcases/*.py service_status/testcases/functional_testcases/*.py + + - name: utility tests + run: | + export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python + export AWS_XRAY_SDK_ENABLED=false + pip3 install setuptools==65.5.0 + pip3 install wheel==0.38.0 + pip3 install -r utility/requirements.txt + PYTHONPATH=$PWD python3 -m coverage run -m pytest utility/testcases/functional_testcases/*.py + + - name: contract_api tests + run: | + export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python + export AWS_XRAY_SDK_ENABLED=false + pip3 install -r contract_api/requirements.txt + PYTHONPATH=$PWD python3 -m coverage run -m pytest contract_api/testcases/unit_testcases/*.py contract_api/testcases/unit_testcases/*/*.py contract_api/testcases/functional_testcases/*.py + + - name: event_pubsub tests + run: | + export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python + export AWS_XRAY_SDK_ENABLED=false + pip3 install -r lambda_layers/web3_and_grpc_libraries/requirements.txt + pip3 install -r lambda_layers/common_python_libraries/requirements.txt + pip3 install -r event_pubsub/requirements.txt + PYTHONPATH=$PWD python3 -m coverage run -m pytest event_pubsub/testcases/unit_testcases/*.py + + - name: orchestrator tests + run: | + export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python + export AWS_XRAY_SDK_ENABLED=false + pip3 install -r orchestrator/requirements.txt + PYTHONPATH=$PWD python3 -m coverage run -m pytest orchestrator/testcases/integration_testcases/*.py orchestrator/testcases/unit_testcases/*.py + + - name: registry tests + run: | + export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python + export AWS_XRAY_SDK_ENABLED=false + pip3 install -r lambda_layers/web3_and_grpc_libraries/requirements.txt + pip3 install -r lambda_layers/common_python_libraries/requirements.txt + pip3 install -r registry/migration/requirements.txt + pip3 install -r registry/requirements.txt + PYTHONPATH=$PWD python3 -m coverage run -m pytest registry/testcases/unit_testcases/*.py registry/testcases/functional_testcases/*.py + + - name: signer tests + run: | + export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python + export AWS_XRAY_SDK_ENABLED=false + pip3 install -r signer/requirements.txt + PYTHONPATH=$PWD python3 -m coverage run -m pytest signer/testcases/integration_testcases/*.py + + - name: verification tests + run: | + export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python + export AWS_XRAY_SDK_ENABLED=false + pip3 install -r verification/requirements.txt + PYTHONPATH=$PWD python3 -m coverage run -m pytest verification/testcases/unit_testcases/*.py verification/testcases/functional_testcases/*.py + + - name: wallets tests + run: | + export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python + export AWS_XRAY_SDK_ENABLED=false + pip3 install -r wallets/requirements.txt + PYTHONPATH=$PWD python3 -m coverage run -m pytest wallets/testcases/integration_testcases/*.py wallets/testcases/unit_testcases/*.py diff --git a/README.md b/README.md index 418e6b717..aba6c62ae 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,5 @@ # snet-marketplace-service -[![CircleCI](https://circleci.com/gh/singnet/snet-cli.svg?style=svg)](https://circleci.com/gh/singnet/snet-marketplace-service) -[![Coverage Status](https://coveralls.io/repos/github/singnet/snet-marketplace-service/badge.svg?branch=master)](https://coveralls.io/github/singnet/snet-marketplace-service?branch=master) ## Getting Started ### SingularityNET Marketplace Services The best way to get started is by understanding the marketplace services that powers the decentralized Blockchain marketplace. Here is a high level view on how SingularityNet's services works. From eefcea0915ec27e8926b256076c059d9db200667 Mon Sep 17 00:00:00 2001 From: Deralden <121487413+Deralden@users.noreply.github.com> Date: Mon, 19 Aug 2024 13:40:21 +0300 Subject: [PATCH 02/16] Services alerts fix (#1835) --- service_status/service_status.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/service_status/service_status.py b/service_status/service_status.py index b1e58fbe7..7e99a343f 100644 --- a/service_status/service_status.py +++ b/service_status/service_status.py @@ -72,6 +72,11 @@ def _update_service_status_parameters(self, status, next_check_timestamp, failed "next_check_timestamp = %s, failed_status_count = %s WHERE row_id = %s " response = self.repo.execute(update_query, [status, next_check_timestamp, failed_status_count, row_id]) return response + + def _update_service_failed_status_count(self, failed_status_count, row_id): + update_query = "UPDATE service_endpoint SET failed_status_count = %s WHERE row_id = %s " + response = self.repo.execute(update_query, [failed_status_count, row_id]) + return response def _update_service_status_stats(self, org_id, service_id, old_status, status): previous_state = "UP" if (old_status == 1) else "DOWN" @@ -105,14 +110,17 @@ def update_service_status(self): row_id=record["row_id"]) if old_status != status: self._update_service_status_stats(record["org_id"], record["service_id"], old_status, status) + if status == 1: + query_data = self._update_service_failed_status_count(failed_status_count=0, row_id=record["row_id"]) if status == 0: org_id = record["org_id"] service_id = record["service_id"] recipients = self._get_service_provider_email(org_id=org_id, service_id=service_id) - self._send_notification(org_id=org_id, service_id=service_id, recipients=recipients, - endpoint=record["endpoint"], error_details=error_details, - debug_error_string=debug_error_string) + if failed_status_count <= 10: + self._send_notification(org_id=org_id, service_id=service_id, recipients=recipients, + endpoint=record["endpoint"], error_details=error_details, + debug_error_string=debug_error_string) rows_updated = rows_updated + query_data[0] logger.info(f"no of rows updated: {rows_updated}") @@ -150,10 +158,9 @@ def _send_notification(self, org_id, service_id, recipients, endpoint, error_det logger.info(f"Invalid email_id: {recipient}") def _get_slack_message(self, org_id, service_id, endpoint, recipients, error_details, debug_error_string): - slack_message = f"```Alert!\n\nService {service_id} under organization {org_id} is down for {NETWORK_NAME} " \ - f"network.\nEndpoint: {endpoint}\nError Details: {error_details}\nDebug Error String: " \ - f"{debug_error_string}\nContributors: {recipients} \n\nFor any queries please email at " \ - f"cs-marketplace@singularitynet.io. \n\nWarmest regards, \nSingularityNET Marketplace Team```" + slack_message = f"Alert!\n\nService {service_id} under organization {org_id} is down for {NETWORK_NAME} " \ + f"network.\nEndpoint: {endpoint}\nDebug Error String: " \ + f"{debug_error_string}" return slack_message def _send_email_notification(self, org_id, service_id, recipient, endpoint): From 202620d2bd3272eaf47a9a2238cb49bd53cf23b7 Mon Sep 17 00:00:00 2001 From: Deralden <121487413+Deralden@users.noreply.github.com> Date: Mon, 19 Aug 2024 17:12:04 +0300 Subject: [PATCH 03/16] Key fix in config (#1837) --- service_status/config.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/service_status/config.py b/service_status/config.py index e34b9ac61..550fe955e 100644 --- a/service_status/config.py +++ b/service_status/config.py @@ -23,3 +23,5 @@ MINIMUM_INTERVAL_IN_HOUR = 1 CERTIFICATION_EXPIRATION_THRESHOLD = 30 BASE_URL_TO_RESET_SERVICE_HEALTH = "" +HOST = '' +AUTH = '' \ No newline at end of file From 6a3330b6db629f70165372980ef9e6c75336a18b Mon Sep 17 00:00:00 2001 From: Deralden <121487413+Deralden@users.noreply.github.com> Date: Mon, 19 Aug 2024 18:27:16 +0300 Subject: [PATCH 04/16] Opensearch logs introduction (#1839) * Opensearch introduction * Add endpoint information to logs * Opensearch package added --- service_status/requirements.txt | 1 + service_status/service_status.py | 39 ++++++++++++++++++++++++++++++-- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/service_status/requirements.txt b/service_status/requirements.txt index 07dba1372..aa4e9149e 100644 --- a/service_status/requirements.txt +++ b/service_status/requirements.txt @@ -9,3 +9,4 @@ pymysql==0.10.1 aws-xray-sdk==2.4.2 grpcio-tools==1.32.0 grpcio-health-checking==1.32.0 +opensearch-py diff --git a/service_status/service_status.py b/service_status/service_status.py index 7e99a343f..32d4b55b1 100644 --- a/service_status/service_status.py +++ b/service_status/service_status.py @@ -2,7 +2,7 @@ import re from datetime import datetime as dt from datetime import timedelta - +from opensearchpy import OpenSearch import grpc from grpc_health.v1 import health_pb2 as heartb_pb2 from grpc_health.v1 import health_pb2_grpc as heartb_pb2_grpc @@ -11,7 +11,7 @@ from common.logger import get_logger from common.utils import Utils from resources.certificates.root_certificate import certificate -from service_status.config import REGION_NAME, NOTIFICATION_ARN, SLACK_HOOK, NETWORKS, NETWORK_ID, \ +from service_status.config import REGION_NAME, NOTIFICATION_ARN, SLACK_HOOK, NETWORKS, NETWORK_ID, HOST, AUTH, \ MAXIMUM_INTERVAL_IN_HOUR, MINIMUM_INTERVAL_IN_HOUR, NETWORK_NAME, BASE_URL_TO_RESET_SERVICE_HEALTH from service_status.constant import SRVC_STATUS_GRPC_TIMEOUT, LIMIT @@ -78,6 +78,40 @@ def _update_service_failed_status_count(self, failed_status_count, row_id): response = self.repo.execute(update_query, [failed_status_count, row_id]) return response + def _send_logs_to_opensearch(self, service_id, debug_error_string, endpoint): + client = OpenSearch( + http_compress = True, + hosts = [{'host': HOST, 'port': 443}], + http_auth = AUTH, + use_ssl = True, + verify_certs = True, + ssl_assert_hostname = False, + ssl_show_warn = False, + ) + timestamp = dt.datetime.now(dt.timezone.utc) + index_name = f"services-logs-{NETWORKS[NETWORK_ID]['name']}-{timestamp.strftime('%Y.%m.%d')}" + if not client.indices.exists(index_name): + index_body = { + 'settings': { + 'index': { + 'number_of_shards': 1 + } + } + } + response = client.indices.create(index_name, body=index_body) + document = { + '@timestamp': timestamp, + 'Log': debug_error_string, + 'Service': service_id, + 'Endpoint': endpoint + } + response = client.index( + index = index_name, + body = document, + refresh = True + ) + return response + def _update_service_status_stats(self, org_id, service_id, old_status, status): previous_state = "UP" if (old_status == 1) else "DOWN" current_state = "UP" if (status == 1) else "DOWN" @@ -117,6 +151,7 @@ def update_service_status(self): org_id = record["org_id"] service_id = record["service_id"] recipients = self._get_service_provider_email(org_id=org_id, service_id=service_id) + self._send_logs_to_opensearch(service_id=service_id, debug_error_string=debug_error_string, endpoint=record["endpoint"]) if failed_status_count <= 10: self._send_notification(org_id=org_id, service_id=service_id, recipients=recipients, endpoint=record["endpoint"], error_details=error_details, From baf0a3d4798ce9ee675997626bbab5c770e13b64 Mon Sep 17 00:00:00 2001 From: Deralden <121487413+Deralden@users.noreply.github.com> Date: Tue, 20 Aug 2024 10:59:58 +0300 Subject: [PATCH 05/16] Datetime fix (#1840) * Opensearch introduction * Add endpoint information to logs * Opensearch package added * datetime fix --------- Co-authored-by: Valery Geraskin --- service_status/service_status.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service_status/service_status.py b/service_status/service_status.py index 32d4b55b1..3543e10b6 100644 --- a/service_status/service_status.py +++ b/service_status/service_status.py @@ -88,7 +88,7 @@ def _send_logs_to_opensearch(self, service_id, debug_error_string, endpoint): ssl_assert_hostname = False, ssl_show_warn = False, ) - timestamp = dt.datetime.now(dt.timezone.utc) + timestamp = dt.utcnow() index_name = f"services-logs-{NETWORKS[NETWORK_ID]['name']}-{timestamp.strftime('%Y.%m.%d')}" if not client.indices.exists(index_name): index_body = { From 276d7f53f0e68ffed10ac6373b0e96b5f6852e71 Mon Sep 17 00:00:00 2001 From: Deralden <121487413+Deralden@users.noreply.github.com> Date: Tue, 20 Aug 2024 17:46:12 +0300 Subject: [PATCH 06/16] Changes to alert message structure (#1842) * Opensearch introduction * Add endpoint information to logs * Opensearch package added * datetime fix * Changes to alert message structure --------- Co-authored-by: Valery Geraskin --- service_status/service_status.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/service_status/service_status.py b/service_status/service_status.py index 3543e10b6..681e33fa6 100644 --- a/service_status/service_status.py +++ b/service_status/service_status.py @@ -193,9 +193,7 @@ def _send_notification(self, org_id, service_id, recipients, endpoint, error_det logger.info(f"Invalid email_id: {recipient}") def _get_slack_message(self, org_id, service_id, endpoint, recipients, error_details, debug_error_string): - slack_message = f"Alert!\n\nService {service_id} under organization {org_id} is down for {NETWORK_NAME} " \ - f"network.\nEndpoint: {endpoint}\nDebug Error String: " \ - f"{debug_error_string}" + slack_message = f"Service {service_id} under organization {org_id} is down for {NETWORK_NAME} network." return slack_message def _send_email_notification(self, org_id, service_id, recipient, endpoint): From a91bdf3f8f3e0fb649d529621e9e117b24a7a323 Mon Sep 17 00:00:00 2001 From: Deralden <121487413+Deralden@users.noreply.github.com> Date: Wed, 21 Aug 2024 11:41:02 +0300 Subject: [PATCH 07/16] Org id added to the logs (#1844) * Opensearch introduction * Add endpoint information to logs * Opensearch package added * datetime fix * Changes to alert message structure * Org id added to the logs --------- Co-authored-by: Valery Geraskin --- service_status/service_status.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/service_status/service_status.py b/service_status/service_status.py index 681e33fa6..32c17b4a4 100644 --- a/service_status/service_status.py +++ b/service_status/service_status.py @@ -78,7 +78,7 @@ def _update_service_failed_status_count(self, failed_status_count, row_id): response = self.repo.execute(update_query, [failed_status_count, row_id]) return response - def _send_logs_to_opensearch(self, service_id, debug_error_string, endpoint): + def _send_logs_to_opensearch(self, service_id, debug_error_string, org_id, endpoint): client = OpenSearch( http_compress = True, hosts = [{'host': HOST, 'port': 443}], @@ -103,6 +103,7 @@ def _send_logs_to_opensearch(self, service_id, debug_error_string, endpoint): '@timestamp': timestamp, 'Log': debug_error_string, 'Service': service_id, + 'Organization': org_id, 'Endpoint': endpoint } response = client.index( @@ -151,7 +152,7 @@ def update_service_status(self): org_id = record["org_id"] service_id = record["service_id"] recipients = self._get_service_provider_email(org_id=org_id, service_id=service_id) - self._send_logs_to_opensearch(service_id=service_id, debug_error_string=debug_error_string, endpoint=record["endpoint"]) + self._send_logs_to_opensearch(service_id=service_id, debug_error_string=debug_error_string, org_id=org_id, endpoint=record["endpoint"]) if failed_status_count <= 10: self._send_notification(org_id=org_id, service_id=service_id, recipients=recipients, endpoint=record["endpoint"], error_details=error_details, From b3eaeab0643aacc813995668d29219fb4811ed77 Mon Sep 17 00:00:00 2001 From: Deralden <121487413+Deralden@users.noreply.github.com> Date: Thu, 22 Aug 2024 16:13:13 +0300 Subject: [PATCH 08/16] Cert monitor alert structure fix (#1846) * Cert monitor alert structure fix * Remove endpoint * Unit test changes --- service_status/monitor_service.py | 6 ++---- .../test_monitor_service_certificates_expiry.py | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/service_status/monitor_service.py b/service_status/monitor_service.py index 9c027cbbe..69c010078 100644 --- a/service_status/monitor_service.py +++ b/service_status/monitor_service.py @@ -23,9 +23,7 @@ "Team

" CERT_EXP_EMAIL_NOTIFICATION_SUBJ = "Certificates are about to expire for service %s for %s network." CERT_EXP_SLACK_NOTIFICATION_MSG = \ - "```Alert!\n\nCertificates for service %s under organization %s for the %s network are about to expire in %s days.\n" \ - "Endpoint: %s \n\nFor any queries please email at cs-marketplace@singularitynet.io. \n\nWarmest regards, " \ - "\nSingularityNET Marketplace Team```" + "Certificates for service %s under organization %s for the %s network are about to expire in %s days." NO_OF_ENDPOINT_TO_TEST_LIMIT = 5 @@ -160,7 +158,7 @@ def _get_certificate_expiration_email_notification_message(org_id, service_id, e @staticmethod def _get_certificate_expiration_slack_notification_message(org_id, service_id, endpoint, days_left_for_expiration): - return CERT_EXP_SLACK_NOTIFICATION_MSG % (service_id, org_id, NETWORK_NAME, days_left_for_expiration, endpoint) + return CERT_EXP_SLACK_NOTIFICATION_MSG % (service_id, org_id, NETWORK_NAME, days_left_for_expiration) class MonitorServiceHealth(MonitorService): diff --git a/service_status/testcases/unit_testcases/test_monitor_service_certificates_expiry.py b/service_status/testcases/unit_testcases/test_monitor_service_certificates_expiry.py index a5ca05d18..46056617a 100644 --- a/service_status/testcases/unit_testcases/test_monitor_service_certificates_expiry.py +++ b/service_status/testcases/unit_testcases/test_monitor_service_certificates_expiry.py @@ -22,10 +22,8 @@ def test_get_certificate_expiration_slack_notification_message(self): days_left_for_expiration = 10 response = self.monitor_service_certificate._get_certificate_expiration_slack_notification_message( org_id=org_id, service_id=service_id, endpoint=endpoint, days_left_for_expiration=days_left_for_expiration) - assert (response == "```Alert!\n\nCertificates for service test_service_id under organization test_org_id for " - "the TEST network are about to expire in 10 days.\nEndpoint: https://dummyendpoint.com \n\n" - "For any queries please email at cs-marketplace@singularitynet.io. \n\nWarmest regards, \n" - "SingularityNET Marketplace Team```") + assert (response == "Certificates for service test_service_id under organization test_org_id for " + "the TEST network are about to expire in 10 days.") def test_get_certificate_expiration_email_notification_message(self): org_id = "test_org_id" From d8444fbab0e2bb8dbf4e09295efad6451ee8b9b8 Mon Sep 17 00:00:00 2001 From: vbakatov Date: Thu, 14 Nov 2024 15:04:37 +0300 Subject: [PATCH 09/16] ignore pricing.proto, training.proto for pulbishing service assets to ipfs --- common/utils.py | 15 +++++++++------ .../services/service_publisher_service.py | 9 ++++++--- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/common/utils.py b/common/utils.py index 1b9052de4..aa883e60a 100644 --- a/common/utils.py +++ b/common/utils.py @@ -233,21 +233,21 @@ def ipfsuri_to_bytesuri(uri): return uri.encode("ascii").ljust(32 * (len(uri) // 32 + 1), b"\0") -def publish_file_in_ipfs(file_url, file_dir, ipfs_client, wrap_with_directory=True): +def publish_file_in_ipfs(file_url, file_dir, ipfs_client, wrap_with_directory=True, ignored_files=[]): filename = download_file_from_url(file_url=file_url, file_dir=file_dir) file_type = os.path.splitext(filename)[1] logger.info(f" file type is = '{file_type.lower()}` ") if file_type.lower() == ".zip": - return publish_zip_file_in_ipfs(filename, file_dir, ipfs_client) + return publish_zip_file_in_ipfs(filename, file_dir, ipfs_client, ingored_files=ignored_files) #todo , you need to tar the folder and add that to the ipfs hash logger.info(f"writing the file on ipfs {file_dir}/{filename} ") ipfs_hash = ipfs_client.write_file_in_ipfs(f"{file_dir}/{filename}", wrap_with_directory) return ipfs_hash -def publish_zip_file_in_ipfs(filename, file_dir, ipfs_client): +def publish_zip_file_in_ipfs(filename, file_dir, ipfs_client, ingored_files=[]): logger.info(f"publish_zip_file_in_ipfs {file_dir}/{filename} ") - file_in_tar_bytes = convert_zip_file_to_tar_bytes(file_dir=file_dir, filename=filename) + file_in_tar_bytes = convert_zip_file_to_tar_bytes(file_dir=file_dir, filename=filename, ingored_files=ingored_files) logger.info(f"file_in_tar_bytes {file_in_tar_bytes} ") return ipfs_client.ipfs_conn.add_bytes(file_in_tar_bytes.getvalue()) @@ -262,13 +262,16 @@ def download_file_from_url(file_url, file_dir): return filename -def convert_zip_file_to_tar_bytes(file_dir, filename): +def convert_zip_file_to_tar_bytes(file_dir, filename, ignored_files=[]): with ZipFile(f"{file_dir}/{filename}", 'r') as zipObj: listOfFileNames = zipObj.namelist() zipObj.extractall(file_dir, listOfFileNames) if not os.path.isdir(file_dir): raise Exception("Directory %s doesn't exists" % file_dir) - files = glob.glob(os.path.join(file_dir, "*.proto")) + files = sorted( + f for f in glob.glob(os.path.join(file_dir, "*.proto")) + if os.path.basename(f) not in ignored_files + ) if len(files) == 0: raise Exception("Cannot find any %s files" % (os.path.join(file_dir, "*.proto"))) files.sort() diff --git a/registry/application/services/service_publisher_service.py b/registry/application/services/service_publisher_service.py index aab3a75c0..6ddeea96a 100644 --- a/registry/application/services/service_publisher_service.py +++ b/registry/application/services/service_publisher_service.py @@ -253,9 +253,12 @@ def publish_service_data_to_ipfs(self): filename = download_file_from_url(file_url=proto_url, file_dir=f"{ASSET_DIR}/{service.org_uuid}/{service.uuid}") logger.info(f"proto file Name Retrieved = '{filename}` ") - asset_ipfs_hash = publish_zip_file_in_ipfs(filename=filename, - file_dir=f"{ASSET_DIR}/{service.org_uuid}/{service.uuid}", - ipfs_client=IPFSUtil(IPFS_URL['url'], IPFS_URL['port'])) + asset_ipfs_hash = publish_zip_file_in_ipfs( + filename=filename, + file_dir=f"{ASSET_DIR}/{service.org_uuid}/{service.uuid}", + ipfs_client=IPFSUtil(IPFS_URL['url'], IPFS_URL['port']), + ingored_files=["pricing.proto", "training.proto"] + ) service.proto = { "model_ipfs_hash": asset_ipfs_hash, "encoding": "proto", From fb87f331c71d7ed815e5d6527c2a7830e1f66ecb Mon Sep 17 00:00:00 2001 From: mirel-dev Date: Thu, 14 Nov 2024 16:03:32 +0300 Subject: [PATCH 10/16] Fix naming --- common/utils.py | 6 +++--- registry/application/services/service_publisher_service.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/common/utils.py b/common/utils.py index aa883e60a..aaa47608c 100644 --- a/common/utils.py +++ b/common/utils.py @@ -238,16 +238,16 @@ def publish_file_in_ipfs(file_url, file_dir, ipfs_client, wrap_with_directory=Tr file_type = os.path.splitext(filename)[1] logger.info(f" file type is = '{file_type.lower()}` ") if file_type.lower() == ".zip": - return publish_zip_file_in_ipfs(filename, file_dir, ipfs_client, ingored_files=ignored_files) + return publish_zip_file_in_ipfs(filename, file_dir, ipfs_client, ignored_files=ignored_files) #todo , you need to tar the folder and add that to the ipfs hash logger.info(f"writing the file on ipfs {file_dir}/{filename} ") ipfs_hash = ipfs_client.write_file_in_ipfs(f"{file_dir}/{filename}", wrap_with_directory) return ipfs_hash -def publish_zip_file_in_ipfs(filename, file_dir, ipfs_client, ingored_files=[]): +def publish_zip_file_in_ipfs(filename, file_dir, ipfs_client, ignored_files=[]): logger.info(f"publish_zip_file_in_ipfs {file_dir}/{filename} ") - file_in_tar_bytes = convert_zip_file_to_tar_bytes(file_dir=file_dir, filename=filename, ingored_files=ingored_files) + file_in_tar_bytes = convert_zip_file_to_tar_bytes(file_dir=file_dir, filename=filename, ignored_files=ignored_files) logger.info(f"file_in_tar_bytes {file_in_tar_bytes} ") return ipfs_client.ipfs_conn.add_bytes(file_in_tar_bytes.getvalue()) diff --git a/registry/application/services/service_publisher_service.py b/registry/application/services/service_publisher_service.py index 6ddeea96a..89196c49d 100644 --- a/registry/application/services/service_publisher_service.py +++ b/registry/application/services/service_publisher_service.py @@ -257,7 +257,7 @@ def publish_service_data_to_ipfs(self): filename=filename, file_dir=f"{ASSET_DIR}/{service.org_uuid}/{service.uuid}", ipfs_client=IPFSUtil(IPFS_URL['url'], IPFS_URL['port']), - ingored_files=["pricing.proto", "training.proto"] + ignored_files=["pricing.proto", "training.proto"] ) service.proto = { "model_ipfs_hash": asset_ipfs_hash, From a3182c2820411f00c163717e1c8f25dd815e69eb Mon Sep 17 00:00:00 2001 From: mirel-dev Date: Thu, 14 Nov 2024 20:57:34 +0300 Subject: [PATCH 11/16] Fix common requrements --- common/ipfs_util.py | 2 +- common/requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/common/ipfs_util.py b/common/ipfs_util.py index 92594502b..ebeb90d01 100644 --- a/common/ipfs_util.py +++ b/common/ipfs_util.py @@ -8,7 +8,7 @@ class IPFSUtil(object): def __init__(self, ipfs_url, port): - self.ipfs_conn = ipfshttpclient.connect(f"/dns4/{ipfs_url}/tcp/{port}/http") + self.ipfs_conn = ipfshttpclient.connect(f"/dns/{ipfs_url}/tcp/{port}/http") def read_bytesio_from_ipfs(self, ipfs_hash): ipfs_data = self.ipfs_conn.cat(ipfs_hash) diff --git a/common/requirements.txt b/common/requirements.txt index edba321bc..fd0761bdc 100644 --- a/common/requirements.txt +++ b/common/requirements.txt @@ -3,4 +3,4 @@ web3==5.10.0 requests==2.22.0 PyMySQL==0.10.1 boto3==1.15.9 -ipfsapi==0.4.3 +ipfsapi==0.4.4 From afa72f2de5218b4cd2df8ee0780209afb1359518 Mon Sep 17 00:00:00 2001 From: mirel-dev Date: Thu, 14 Nov 2024 21:55:13 +0300 Subject: [PATCH 12/16] Fix requirements ipfs daemon version: ipfshttpclient==0.4.13.2 --- common/requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/common/requirements.txt b/common/requirements.txt index fd0761bdc..fabeb9221 100644 --- a/common/requirements.txt +++ b/common/requirements.txt @@ -4,3 +4,4 @@ requests==2.22.0 PyMySQL==0.10.1 boto3==1.15.9 ipfsapi==0.4.4 +ipfshttpclient==0.4.13.2 From 08a326109fe9d1c5187de3e1fa774647cc4fa594 Mon Sep 17 00:00:00 2001 From: mirel-dev Date: Fri, 15 Nov 2024 08:42:53 +0300 Subject: [PATCH 13/16] Fix requirements for python common layer --- lambda_layers/common_python_libraries/requirements.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lambda_layers/common_python_libraries/requirements.txt b/lambda_layers/common_python_libraries/requirements.txt index 25ed0b9c8..15dee69a6 100644 --- a/lambda_layers/common_python_libraries/requirements.txt +++ b/lambda_layers/common_python_libraries/requirements.txt @@ -9,7 +9,8 @@ sqlalchemy==1.3.5 aws-xray-sdk==2.4.2 botocore==1.19.55 boto3==1.16.1 -ipfsapi==0.4.3 +ipfsapi==0.4.4 +ipfshttpclient==0.4.13.2 pymysql==0.9.2 setuptools==57.4.0 dxlmispservice==0.1.5 From a41cdcc387ced45d9fcef11724a871fc9e4daeab Mon Sep 17 00:00:00 2001 From: mirel-dev Date: Fri, 15 Nov 2024 23:54:14 +0300 Subject: [PATCH 14/16] Fix requirements for web3_grpc_layer --- lambda_layers/web3_and_grpc_libraries/requirements.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lambda_layers/web3_and_grpc_libraries/requirements.txt b/lambda_layers/web3_and_grpc_libraries/requirements.txt index 365f82265..b9c1c75ba 100644 --- a/lambda_layers/web3_and_grpc_libraries/requirements.txt +++ b/lambda_layers/web3_and_grpc_libraries/requirements.txt @@ -1,6 +1,8 @@ rlp==1.2.0 protobuf==3.10.0 web3==5.10.0 +ipfshttpclient==0.4.13.2 +ipfsapi==0.4.4 grpcio==1.30.0 grpcio-health-checking==1.19.0 grpcio-tools==1.19.0 From 86df790a3b8c679877b08e23b02fbd8a139d8eca Mon Sep 17 00:00:00 2001 From: Deralden <121487413+Deralden@users.noreply.github.com> Date: Thu, 21 Nov 2024 15:46:25 +0300 Subject: [PATCH 15/16] Serverless fixes for signer and wallet (#1854) --- signer/serverless.yml | 2 ++ wallets/serverless.yml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/signer/serverless.yml b/signer/serverless.yml index 86c2de349..21d1a5bf3 100644 --- a/signer/serverless.yml +++ b/signer/serverless.yml @@ -94,7 +94,9 @@ package: - License - log_setup.py - heath_check.sh + - node_modules/** include: + - node_modules/singularitynet-platform-contracts/** - resources/** diff --git a/wallets/serverless.yml b/wallets/serverless.yml index 75516cc11..a569fffbf 100644 --- a/wallets/serverless.yml +++ b/wallets/serverless.yml @@ -111,7 +111,9 @@ package: - License - log_setup.py - heath_check.sh + - node_modules/** include: + - node_modules/singularitynet-platform-contracts/** - resources/** From 87f8519a7ce1bff52cf36db0ad1641b9fe8e8b0a Mon Sep 17 00:00:00 2001 From: Arondondon Date: Fri, 29 Nov 2024 16:11:57 +0300 Subject: [PATCH 16/16] service_status: added additional logs, changed service amount to check from 5 to 10 --- service_status/constant.py | 2 +- service_status/service_status.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/service_status/constant.py b/service_status/constant.py index 3dee2dfbf..5615b7fcc 100644 --- a/service_status/constant.py +++ b/service_status/constant.py @@ -1,2 +1,2 @@ SRVC_STATUS_GRPC_TIMEOUT = 10 -LIMIT = 5 \ No newline at end of file +LIMIT = 10 \ No newline at end of file diff --git a/service_status/service_status.py b/service_status/service_status.py index 32c17b4a4..5bf7dca6c 100644 --- a/service_status/service_status.py +++ b/service_status/service_status.py @@ -135,6 +135,8 @@ def update_service_status(self): logger.info(f"error_details: {error_details}") logger.info(f"debug_error_string: {debug_error_string}") old_status = int.from_bytes(record["is_available"], "big") + logger.info(f"Service to check: row_id={record['row_id']}, status={status}, old_status={old_status}") + logger.info(f"Service endpoint: {record['endpoint']}") failed_status_count = self._calculate_failed_status_count( current_status=status, old_status=old_status, old_failed_status_count=record["failed_status_count"])