Skip to content

Commit

Permalink
make sure para_id params are cast to string to be properly compared t…
Browse files Browse the repository at this point in the history
…o the string para_id labels on pods
  • Loading branch information
PierreBesson committed Sep 1, 2023
1 parent e460003 commit b5917c9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions app/lib/kubernetes_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def list_validator_stateful_sets(role='authority'):
return list(map(lambda sts: sts['metadata']['name'], validator_stateful_sets))


def list_parachain_collator_stateful_sets(para_id):
def list_parachain_collator_stateful_sets(para_id: str):
stateful_sets = kubernetes_client.CustomObjectsApi().list_namespaced_custom_object(group="apps", version="v1", plural="statefulsets", namespace=namespace)

collator_stateful_sets = list(
Expand Down Expand Up @@ -50,7 +50,7 @@ def list_validator_pods(stateful_set_name):
return validator_pods


def list_collator_pods(para_id=None, stateful_set_name=None):
def list_collator_pods(para_id: str = None, stateful_set_name: str = None):
collator_pods = list_substrate_node_pods('collator')
if stateful_set_name:
collator_pods = list(filter(lambda pod: pod.metadata.owner_references[0].name == stateful_set_name, collator_pods))
Expand Down
10 changes: 5 additions & 5 deletions app/lib/network_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ def list_parachains():
return parachains


async def onboard_parachain_by_id(para_id, force_queue_action):
async def onboard_parachain_by_id(para_id: str, force_queue_action: bool):
log.info(f'starting to onboard parachain #{para_id}')
relay_chain_client = get_relay_chain_client()
sudo_seed = network_sudo_seed()
Expand All @@ -509,7 +509,7 @@ async def onboard_parachain_by_id(para_id, force_queue_action):
log.error(f"Couldn't find parachain pod for para_id={para_id}")


async def offboard_parachain_by_id(para_id, force_queue_action):
async def offboard_parachain_by_id(para_id: str, force_queue_action: bool):
log.info(f'starting to offboard parachain #{para_id}')
substrate_client = get_relay_chain_client()
sudo_seed = network_sudo_seed()
Expand All @@ -521,7 +521,7 @@ async def offboard_parachain_by_id(para_id, force_queue_action):


# Collators
def list_parachain_collators(para_id, stateful_set_name=''):
def list_parachain_collators(para_id: str, stateful_set_name: str = ''):
collator_pods = list_collator_pods(para_id, stateful_set_name)
# Read the first collator pod chain metadata for this para_id to retrieve the chain name
if collator_pods:
Expand Down Expand Up @@ -630,7 +630,7 @@ async def deregister_collator_nodes(chain, nodes, ss58_format):
return accounts_to_deregister


async def register_statefulset_collators(para_id, stateful_set_name):
async def register_statefulset_collators(para_id: str, stateful_set_name: str):
log.info('starting to register collators in statefulset {}'.format(stateful_set_name))
collators_pods = list_collator_pods(para_id, stateful_set_name)
chain = collators_pods[0].metadata.labels['chain']
Expand All @@ -639,7 +639,7 @@ async def register_statefulset_collators(para_id, stateful_set_name):
await register_collator_nodes(chain, collator_node_names, ss58_format)


async def deregister_statefulset_collators(para_id, stateful_set_name):
async def deregister_statefulset_collators(para_id: str, stateful_set_name: str):
log.info('starting to deregister collators in statefulset {}'.format(stateful_set_name))
collators_pods = list_collator_pods(para_id, stateful_set_name)
chain = collators_pods[0].metadata.labels['chain']
Expand Down

0 comments on commit b5917c9

Please sign in to comment.