<commit_before>package scheduler

import "net"
import log "github.com/golang/glog"
import cloud "github.com/GoogleCloudPlatform/kubernetes/pkg/cloudprovider"

// implementation of cloud.Interface
func (k *KubernetesScheduler) Instances() (cloud.Instances, bool) {
	return k, true
}

// implementation of cloud.Interface
func (k *KubernetesScheduler) TCPLoadBalancer() (cloud.TCPLoadBalancer, bool) {
	return nil, false
}

// implementation of cloud.Interface
func (k *KubernetesScheduler) Zones() (cloud.Zones, bool) {
	return nil, false
}

// implementation of cloud.Instances
func (k *KubernetesScheduler) IPAddress(name string) (net.IP, error) {
	// TODO(jdef): validate that name actually points to a slave that we know
	if iplist, err := net.LookupIP(name); err != nil {
		log.Warningf("Failed to resolve IP from host name '%v': %v", name, err)
		return nil, err
	} else {
		ipaddr := iplist[0]
		log.V(2).Infof("returning IP to '%v'", ipaddr)
		return ipaddr, nil
	}
}

// implementation of cloud.Instances
func (k *KubernetesScheduler) List(filter string) ([]string, error) {
	k.RLock()
	defer k.RUnlock()

	var slaveHosts []string
	for _, slave := range k.slaves {
		slaveHosts = append(slaveHosts, slave.HostName)
	}
	return slaveHosts, nil<commit_msg>added docs, better logging for IP address resolution<commit_after>package scheduler

import "net"
import log "github.com/golang/glog"
import cloud "github.com/GoogleCloudPlatform/kubernetes/pkg/cloudprovider"

// implementation of cloud.Interface; Mesos natively provides minimal cloud-type resources.
// More robust cloud support requires a combination of Mesos and cloud-specific knowledge,
// which will likely never be present in this vanilla implementation.
func (k *KubernetesScheduler) Instances() (cloud.Instances, bool) {
	return k, true
}

// implementation of cloud.Interface; Mesos does not provide any type of native load
// balancing by default, so this implementation always returns (nil,false).
func (k *KubernetesScheduler) TCPLoadBalancer() (cloud.TCPLoadBalancer, bool) {
	return nil, false
}

// implementation of cloud.Interface; Mesos does not provide any type of native region
// or zone awareness, so this implementation always returns (nil,false).
func (k *KubernetesScheduler) Zones() (cloud.Zones, bool) {
	return nil, false
}

// implementation of cloud.Instances
func (k *KubernetesScheduler) IPAddress(name string) (net.IP, error) {
	// TODO(jdef): validate that name actually points to a slave that we know
	if iplist, err := net.LookupIP(name); err != nil {
		log.Warningf("Failed to resolve IP from host name '%v': %v", name, err)
		return nil, err
	} else {
		ipaddr := iplist[0]
		log.V(2).Infof("Resolved host to '%v' to '%v'", name, ipaddr)
		return ipaddr, nil
	}
}

// implementation of cloud.Instances
func (k *KubernetesScheduler) List(filter string) ([]string, error) {
	k.RLock()
	defer k.RUnlock()

	var slaveHosts []string
	for _, slave := range k.slaves {
		slaveHosts = append(slaveHosts, slave.HostName)
	}
	return slaveHosts, nil
{'fraction_non_alphanumeric': 0.11418229680816058, 'fraction_numerical': 0.0013162224415926291, 'mean_word_length': 4.703564727954972, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4366414', 'n_tokens_mistral': 965, 'n_tokens_neox': 937, 'n_words': 323}