def get_instances(self):
        if self.get_desired_state() == 'start':
            if self.get_max_instances() is not None:
                try:
                    zk_instances = get_instances_from_zookeeper(
                        service=self.service,
                        instance=self.instance,
                    )
                except NoNodeError:  # zookeeper doesn't have instance data for this app
                    return self.get_min_instances()
                else:
                    return self.limit_instance_count(zk_instances)
            else:
                return self.config_dict.get('instances', 1)
        else:
            return 0
Get the number of instances specified in zookeeper or the service's marathon configuration.
dataset/ETHPy150Open Yelp/paasta/paasta_tools/marathon_tools.py/MarathonServiceConfig.get_instances