diff --git a/services/voting-node/voting_node/importer.py b/services/voting-node/voting_node/importer.py index 224c2e6f67..c4e17b4415 100644 --- a/services/voting-node/voting_node/importer.py +++ b/services/voting-node/voting_node/importer.py @@ -162,22 +162,14 @@ def _remaining_intervals_n_seconds_to_next_snapshot(self, current_time: datetime async def _ideascale_snapshot(self, event_id: int) -> None: """Call the 'ideascale-importer ideascale import-all ' command.""" - try: - # Initialize external data importer - importer = ExternalDataImporter() - await importer.ideascale_import_all(event_id) - # raise Exception("ideascale import is DISABLED. Skipping...") - except Exception as e: - logger.error(f"snapshot: {e}") + importer = ExternalDataImporter() + await importer.ideascale_import_all(event_id) + # raise Exception("ideascale import is DISABLED. Skipping...") async def _dbsync_snapshot(self, event_id: int) -> None: """Call the 'ideascale-importer snapshot import ' command.""" - try: - # Initialize external data importer - importer = ExternalDataImporter() - await importer.snapshot_import(event_id) - except Exception as e: - logger.error(f"snapshot: {e}") + importer = ExternalDataImporter() + await importer.snapshot_import(event_id) async def take_snapshots(self, event_id: int) -> None: """Takes snapshots at regular intervals using ExternalDataImporter. diff --git a/services/voting-node/voting_node/main.py b/services/voting-node/voting_node/main.py index efe413f6e8..0361251227 100644 --- a/services/voting-node/voting_node/main.py +++ b/services/voting-node/voting_node/main.py @@ -3,6 +3,8 @@ Main entrypoint for executing the voting node service from the shell command-line. """ +import json +import logging import click import uvicorn from ideascale_importer.utils import configure_logger @@ -30,7 +32,7 @@ def voting_node_cli(): """Deploy a jormungandr node for voting events.""" -@click.command() +@click.command(context_settings={"show_default": True}) @click.option( "--reloadable", is_flag=True, @@ -50,7 +52,7 @@ def voting_node_cli(): default="0.0.0.0", help="""Host for the voting node API. - If left unset it will look for envvar `VOTING_HOST`. If no host is found, the default value is: 0.0.0.0""", + If left unset it will look for envvar `VOTING_HOST`.""", ) @click.option( "--api-port", @@ -58,7 +60,7 @@ def voting_node_cli(): default=8000, help="""Port for the voting node API. - If left unset it will look for envvar `VOTING_PORT`. If no port is found, the default value is: 8000""", + If left unset it will look for envvar `VOTING_PORT`.""", ) @click.option( "--log-level", @@ -67,16 +69,16 @@ def voting_node_cli(): type=click.Choice(["info", "debug", "warn", "error", "trace"]), help="""Set the level for logs in the voting node. - If left unset it will look for envvar `VOTING_LOG_LEVEL`. If no level is found, the default value is: info""", + If left unset it will look for envvar `VOTING_LOG_LEVEL`.""", ) @click.option( "--log-format", envvar=VOTING_LOG_FORMAT, - default="text", + default="json", type=click.Choice(["text", "json"]), help="""Set the format for logs in the voting node. - If left unset it will look for envvar `VOTING_LOG_FORMAT`. If no format is found, the default value is: text""", + If left unset it will look for envvar `VOTING_LOG_FORMAT`.""", ) @click.option( "--database-url", diff --git a/utilities/ideascale-importer/ideascale_importer/snapshot_importer.py b/utilities/ideascale-importer/ideascale_importer/snapshot_importer.py index 0dd5fde8ab..3c796a954d 100644 --- a/utilities/ideascale-importer/ideascale_importer/snapshot_importer.py +++ b/utilities/ideascale-importer/ideascale_importer/snapshot_importer.py @@ -266,6 +266,7 @@ class SnapshotReport(BaseModel): registrations_count: int = 0 registered_voting_power: int = 0 unregistered_voting_power: int = 0 + eligible_voters_count: int = 0 processed_voting_power: int = 0 cip_15_registration_count: int = 0 cip_36_single_registration_count: int = 0 @@ -702,6 +703,7 @@ async def _write_db_data(self): for ctd in network_processed_snapshot: for snapshot_contribution in ctd.contributions: network_report.processed_voting_power += snapshot_contribution.value + network_report.eligible_voters_count += 1 voting_key = ctd.hir.voting_key # This can be removed once it's fixed in catalyst-toolbox @@ -746,6 +748,7 @@ async def _write_db_data(self): total_cip_36_multi_registrations=network_report.cip_36_multi_registration_count, total_registered_voting_power=network_report.registered_voting_power, total_unregistered_voting_power=network_report.unregistered_voting_power, + total_eligible_voters=network_report.eligible_voters_count, total_processed_voting_power=network_report.processed_voting_power, total_rewards_payable=network_report.rewards_payable, total_rewards_unpayable=network_report.rewards_unpayable,