def _get_deployment_args(self, args):
    parsed_args = {'head_deployment': None, 'deployments': []}
    shards = getattr(args, 'shards', 1)
    uses_before = getattr(args, 'uses_before', None)
    uses_after = getattr(args, 'uses_after', None)
    if (args.name != 'gateway'):
        parsed_args['head_deployment'] = BaseDeployment._copy_to_head_args(self.args)
        parsed_args['head_deployment'].gpus = None
        parsed_args['head_deployment'].port = K8sGrpcConnectionPool.K8S_PORT
        parsed_args['head_deployment'].uses = None
        parsed_args['head_deployment'].uses_metas = None
        parsed_args['head_deployment'].uses_with = None
        parsed_args['head_deployment'].env = None
        if (not self.k8s_connection_pool):
            import json
            connection_list = {}
            for i in range(shards):
                name = (f'{to_compatible_name(self.name)}-{i}' if (shards > 1) else f'{to_compatible_name(self.name)}')
                connection_list[str(i)] = f'{name}.{self.k8s_namespace}.svc:{K8sGrpcConnectionPool.K8S_PORT}'
            parsed_args['head_deployment'].connection_list = json.dumps(connection_list)
    if uses_before:
        parsed_args['head_deployment'].uses_before_address = f'127.0.0.1:{K8sGrpcConnectionPool.K8S_PORT_USES_BEFORE}'
    if uses_after:
        parsed_args['head_deployment'].uses_after_address = f'127.0.0.1:{K8sGrpcConnectionPool.K8S_PORT_USES_AFTER}'
    for i in range(shards):
        cargs = copy.deepcopy(args)
        cargs.shard_id = i
        cargs.uses_before = None
        cargs.uses_after = None
        if (args.name != 'gateway'):
            cargs.port = K8sGrpcConnectionPool.K8S_PORT
        cargs.uses_before_address = None
        cargs.uses_after_address = None
        if (shards > 1):
            cargs.name = f'{cargs.name}-{i}'
        if (args.name == 'gateway'):
            cargs.pod_role = PodRoleType.GATEWAY
        else:
            cargs.k8s_connection_pool = False
        parsed_args['deployments'].append(cargs)
    return parsed_args
def _get_deployment_args(self, args):
    parsed_args = {'head_deployment': None, 'deployments': []}
    shards = getattr(args, 'shards', 1)
    uses_before = getattr(args, 'uses_before', None)
    uses_after = getattr(args, 'uses_after', None)
    if (args.name != 'gateway'):
        parsed_args['head_deployment'] = BaseDeployment._copy_to_head_args(self.args)
        parsed_args['head_deployment'].gpus = None
        parsed_args['head_deployment'].port = K8sGrpcConnectionPool.K8S_PORT
        parsed_args['head_deployment'].uses = None
        parsed_args['head_deployment'].uses_metas = None
        parsed_args['head_deployment'].uses_with = None
        parsed_args['head_deployment'].env = None
        if (not self.k8s_connection_pool):
            import json
            connection_list = {}
            for i in range(shards):
                name = (f'{to_compatible_name(self.name)}-{i}' if (shards > 1) else f'{to_compatible_name(self.name)}')
                connection_list[str(i)] = f'{name}.{self.k8s_namespace}.svc:{K8sGrpcConnectionPool.K8S_PORT}'
            parsed_args['head_deployment'].connection_list = json.dumps(connection_list)
    if uses_before:
        parsed_args['head_deployment'].uses_before_address = f'127.0.0.1:{K8sGrpcConnectionPool.K8S_PORT_USES_BEFORE}'
    if uses_after:
        parsed_args['head_deployment'].uses_after_address = f'127.0.0.1:{K8sGrpcConnectionPool.K8S_PORT_USES_AFTER}'
    for i in range(shards):
        cargs = copy.deepcopy(args)
        cargs.shard_id = i
        cargs.uses_before = None
        cargs.uses_after = None
        if (args.name != 'gateway'):
            cargs.port = K8sGrpcConnectionPool.K8S_PORT
        cargs.uses_before_address = None
        cargs.uses_after_address = None
        if (shards > 1):
            cargs.name = f'{cargs.name}-{i}'
        if (args.name == 'gateway'):
            cargs.pod_role = PodRoleType.GATEWAY
        else:
            cargs.k8s_connection_pool = False
        parsed_args['deployments'].append(cargs)
    return parsed_args