55import urllib .request
66from typing import Optional
77
8- from common_lib import NamespaceAndInstructionArgs , RestartStrategy , Service , print_colored
8+ from common_lib import NamespaceAndInstructionArgs , RestartStrategy , Service
99from restarter_lib import ServiceRestarter
1010from update_config_and_restart_nodes_lib import (
1111 ApolloArgsParserBuilder ,
1212 ConfigValuesUpdater ,
1313 get_configmap ,
14- get_current_block_number ,
1514 get_logs_explorer_url ,
1615 parse_config_from_yaml ,
1716 update_config_and_restart_nodes ,
2221def get_logs_explorer_url_for_proposal (
2322 namespace : str ,
2423 validator_id : str ,
25- min_block_number : int ,
2624 project_name : str ,
2725) -> str :
2826 # Remove the 0x prefix from the validator id to get the number.
@@ -31,8 +29,7 @@ def get_logs_explorer_url_for_proposal(
3129 query = (
3230 f'resource.labels.namespace_name:"{ urllib .parse .quote (namespace )} "\n '
3331 f'resource.labels.container_name="sequencer-core"\n '
34- f'textPayload =~ "DECISION_REACHED:.*proposer 0x0*{ validator_id } "\n '
35- f'CAST(REGEXP_EXTRACT(textPayload, "height: (\\ \\ d+)"), "INT64") > { min_block_number } '
32+ f'textPayload =~ "DECISION_REACHED:.*proposer 0x0*{ validator_id } "'
3633 )
3734 return get_logs_explorer_url (query , project_name )
3835
@@ -61,42 +58,31 @@ def get_updated_config_for_instance(
6158def main ():
6259 usage_example = """
6360Examples:
64- # Restart all nodes at once.
65- %(prog)s --namespace-prefix apollo-sepolia-integration --num-nodes 3 --feeder-url feeder.integration-sepolia.starknet.io --project-name my-gcp-project
66- %(prog)s -n apollo-sepolia-integration -m 3 -f feeder.integration-sepolia.starknet.io --project-name my-gcp-project
67-
68- # Restart nodes with cluster prefix
69- %(prog)s -n apollo-sepolia-integration -m 3 -c my-cluster -f feeder.integration-sepolia.starknet.io --project-name my-gcp-project
70-
71- # Restart nodes starting from specific node index
72- %(prog)s -n apollo-sepolia-integration -m 3 -s 5 -f feeder.integration-sepolia.starknet.io --project-name my-gcp-project
73-
74- # Use different feeder URL
75- %(prog)s -n apollo-sepolia-integration -m 3 -f feeder.integration-sepolia.starknet.io --project-name my-gcp-project
76-
77- # Use namespace list instead of prefix (restart specific namespaces)
78- %(prog)s --namespace-list apollo-sepolia-integration-0 apollo-sepolia-integration-2 -f feeder.integration-sepolia.starknet.io --project-name my-gcp-project
79- %(prog)s -N apollo-sepolia-integration-0 apollo-sepolia-integration-2 -f feeder.integration-sepolia.starknet.io --project-name my-gcp-project
80-
61+ # Take all nodes out of observer mode at once.
62+ %(prog)s --namespace-prefix apollo-sepolia-integration --num-nodes 3 --project-name my-gcp-project --validator-id-start-from 64
63+ %(prog)s -n apollo-sepolia-integration -m 3 --project-name my-gcp-project --validator-id-start-from 64
64+
65+ # Take nodes out of observer mode with cluster prefix
66+ %(prog)s -n apollo-sepolia-integration -m 3 -c my-cluster --project-name my-gcp-project --validator-id-start-from 64
67+
68+ # Take nodes out of observer mode starting from a specific node index
69+ %(prog)s -n apollo-sepolia-integration -m 3 -s 5 --project-name my-gcp-project --validator-id-start-from 64
70+
71+ # Use namespace list instead of prefix (operate on specific namespaces)
72+ %(prog)s --namespace-list apollo-sepolia-integration-0 apollo-sepolia-integration-2 --project-name my-gcp-project --validator-id-start-from 64
73+ %(prog)s -N apollo-sepolia-integration-0 apollo-sepolia-integration-2 --project-name my-gcp-project --validator-id-start-from 64
74+
8175 # Use cluster list for multiple clusters (only works with namespace-list, not namespace-prefix)
82- %(prog)s -N apollo-sepolia-integration-0 apollo-sepolia-integration-1 -C cluster1 cluster2 -f feeder.integration-sepolia.starknet.io -- project-name my-gcp-project
83- %(prog)s --namespace-list apollo-sepolia-integration-0 apollo-sepolia-integration-1 --cluster-list cluster1 cluster2 -f feeder.integration-sepolia.starknet.io -- project-name my-gcp-project
76+ %(prog)s -N apollo-sepolia-integration-0 apollo-sepolia-integration-1 -C cluster1 cluster2 -- project-name my-gcp-project --validator-id-start-from 64
77+ %(prog)s --namespace-list apollo-sepolia-integration-0 apollo-sepolia-integration-1 --cluster-list cluster1 cluster2 -- project-name my-gcp-project --validator-id-start-from 64
8478 """
8579
8680 args_builder = ApolloArgsParserBuilder (
87- "Restart all nodes using the value from the feeder URL " ,
81+ "Take nodes out of observer mode by assigning validator IDs and restarting them " ,
8882 usage_example ,
8983 include_restart_strategy = False ,
9084 )
9185
92- args_builder .add_argument (
93- "-f" ,
94- "--feeder-url" ,
95- required = True ,
96- type = str ,
97- help = "The feeder URL to get the current block from" ,
98- )
99-
10086 # TODO(guy.f): Remove this when we rely on metrics for restarting.
10187 args_builder .add_argument (
10288 "--project-name" ,
@@ -113,25 +99,15 @@ def main():
11399
114100 args = args_builder .build ()
115101
116- # Get current block number from feeder URL
117- current_block_number = get_current_block_number (args .feeder_url )
118- next_block_number = current_block_number + 1
119-
120- print_colored (f"Current block number: { current_block_number } " )
121- print_colored (f"Next block number: { next_block_number } " )
122-
123102 namespace_list = NamespaceAndInstructionArgs .get_namespace_list_from_args (args )
124103 context_list = NamespaceAndInstructionArgs .get_context_list_from_args (args )
125104
126- # Generate logs explorer URLs if needed
127105 post_restart_instructions = []
128106
129107 for namespace , context in zip (namespace_list , context_list or [None ] * len (namespace_list )):
130108 url = get_logs_explorer_url_for_proposal (
131109 namespace ,
132110 get_validator_id (namespace , context ),
133- # Feeder could be behind by up to 10 blocks, so we add 10 to the current block number.
134- current_block_number + 10 ,
135111 args .project_name ,
136112 )
137113 post_restart_instructions .append (
0 commit comments