<commit_before>package kubeutil

import (
	"fmt"
	"os"
	"strings"

	edlresource "github.com/PaddlePaddle/cloud/go/edl/resource"
	"k8s.io/api/core/v1"
	"k8s.io/api/extensions/v1beta1"
	"k8s.io/apimachinery/pkg/api/errors"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/client-go/kubernetes"
	"k8s.io/client-go/rest"
	"k8s.io/client-go/tools/clientcmd"
)

func buildConfig(kubeconfig string) (*rest.Config, error) {
	return clientcmd.BuildConfigFromFlags("", kubeconfig)
}

// CreateClient creates ClientSet and rest.RESTClient used by client.
func CreateClient(kubeconfig string) (*rest.RESTClient, *kubernetes.Clientset, error) {
	config, err := buildConfig(kubeconfig)
	if err != nil {
		return nil, nil, fmt.Errorf("init from config '%s' error: %v", kubeconfig, err)
	}

	clientset, err := kubernetes.NewForConfig(config)
	if err != nil {
		return nil, nil, fmt.Errorf("create clientset from config '%s' error: %v", kubeconfig, err)
	}

	edlresource.RegisterTrainingJob(config)

	client, err := rest.RESTClientFor(config)<commit_msg>fix build<commit_after>package kubeutil

import (
	"fmt"
	"os"
	"strings"

	edlresource "github.com/PaddlePaddle/cloud/go/edl/resource"
	"k8s.io/api/core/v1"
	"k8s.io/api/extensions/v1beta1"
	"k8s.io/apimachinery/pkg/api/errors"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/client-go/kubernetes"
	"k8s.io/client-go/rest"
	"k8s.io/client-go/tools/clientcmd"
)

func buildConfig(kubeconfig string) (*rest.Config, error) {
	return clientcmd.BuildConfigFromFlags("", kubeconfig)
}

// CreateClient creates ClientSet and rest.RESTClient used by client.
func CreateClient(kubeconfig string) (*rest.RESTClient, *kubernetes.Clientset, error) {
	config, err := buildConfig(kubeconfig)
	if err != nil {
		return nil, nil, fmt.Errorf("init from config '%s' error: %v", kubeconfig, err)
	}

	clientset, err := kubernetes.NewForConfig(config)
	if err != nil {
		return nil, nil, fmt.Errorf("create clientset from config '%s' error: %v", kubeconfig, err)
	}

	edlresource.RegisterResource(config, &edlresource.TrainingJob{}, &edlresource.TrainingJobList{})

	client, err := rest.RESTClientFor(config)
{'fraction_non_alphanumeric': 0.14572629612330687, 'fraction_numerical': 0.011209715086408221, 'mean_word_length': 5.0852272727272725, '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': '2619610', 'n_tokens_mistral': 837, 'n_tokens_neox': 814, 'n_words': 156}