Skip to content

Commit

Permalink
style: fix overload and cli autocomplete
Browse files Browse the repository at this point in the history
  • Loading branch information
jina-bot committed Nov 30, 2023
1 parent 0767056 commit a429507
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions jina/orchestrate/deployments/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ async def _async_call_add_voters(leader, voters, replica_ids, logger):
# this method needs to be run in multiprocess, importing jraft in main process
# makes it impossible to do tests sequentially
from jina.serve.consensus.add_voter.call_add_voter import async_call_add_voter

logger.debug(f'Trying to add {len(replica_ids)} voters to leader {leader}')
for voter_address, replica_id in zip(voters, replica_ids):
logger.debug(
Expand All @@ -114,7 +115,9 @@ async def _async_call_add_voters(leader, voters, replica_ids, logger):
success = False
for i in range(5):
logger.debug(f'Trying {i}th time')
success = await async_call_add_voter(leader, str(replica_id), voter_address, logger)
success = await async_call_add_voter(
leader, str(replica_id), voter_address, logger
)
if success:
logger.debug(f'Trying {i}th time succeeded')
break
Expand All @@ -134,6 +137,7 @@ async def _async_call_add_voters(leader, voters, replica_ids, logger):
logger.debug('Adding voters to leader finished')
return success


class Deployment(JAMLCompatible, PostMixin, BaseOrchestrator, metaclass=DeploymentType):
"""A Deployment is an immutable set of pods, which run in replicas. They share the same input and output socket.
Internally, the pods can run with the process/thread backend. They can also be run in their own containers
Expand Down Expand Up @@ -181,11 +185,11 @@ async def _async_add_voter_to_leader(self):
replica_ids = [pod.args.replica_id for pod in self._pods[1:]]
self.logger.debug('Starting process to call Add Voters')
res = await _async_call_add_voters(
leader=leader_address,
voters=voter_addresses,
replica_ids=replica_ids,
logger=self.logger,
)
leader=leader_address,
voters=voter_addresses,
replica_ids=replica_ids,
logger=self.logger,
)
if res:
self.logger.debug('Add Voters process finished')
else:
Expand Down

0 comments on commit a429507

Please sign in to comment.