func (j *JobUpdater) IsReleased() bool {
	return j.Job.Status.Released
}
IsReleased returns if tj has released resource
package updater
import (
	"errors"
	"fmt"
	"reflect"
	"strconv"
	"strings"
	"time"
	"github.com/golang/glog"
	log "github.com/inconshreveable/log15"
	corev1 "k8s.io/api/core/v1"
	"k8s.io/api/extensions/v1beta1"
	apierrors "k8s.io/apimachinery/pkg/api/errors"
	"k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/types"
	"k8s.io/client-go/kubernetes"
	typedcorev1 "k8s.io/client-go/kubernetes/typed/core/v1"
	"k8s.io/client-go/tools/record"
	paddlev1 "github.com/baidu/paddle-on-k8s-operator/pkg/apis/paddlepaddle/v1alpha1"
	trainingJobClient "github.com/baidu/paddle-on-k8s-operator/pkg/client/clientset/versioned"
	"github.com/baidu/paddle-on-k8s-operator/pkg/client/clientset/versioned/scheme"
)
var (
	ErrorUnkownResourceType = errors.New("UnknownResourceType")
)
type JobUpdater struct {
	Job            *paddlev1.TrainingJob
	kubeCli        kubernetes.Interface
	trainingJobCli trainingJobClient.Interface
	status         paddlev1.TrainingJobStatus
	recorder       record.EventRecorder
	autoclean      bool
	Additional     int32
	restartLimit   int
	outter         bool
}
func NewJobUpdater(job *paddlev1.TrainingJob, kubeCli kubernetes.Interface, jobCli trainingJobClient.Interface,
	auto bool, restartLimit int, outter bool) *JobUpdater {
	eventBroadcaster := record.NewBroadcaster()
	eventBroadcaster.StartLogging(glog.Infof)
	eventBroadcaster.StartRecordingToSink(&typedcorev1.EventSinkImpl{Interface: kubeCli.CoreV1().Events("")})
	recorder := eventBroadcaster.NewRecorder(scheme.Scheme, corev1.EventSource{Component: "TrainingJobController"})
	return &JobUpdater{
		Job:            job,
		kubeCli:        kubeCli,
		trainingJobCli: jobCli,
		status:         *job.Status.DeepCopy(),
		recorder:       recorder,
		autoclean:      auto,
		restartLimit:   restartLimit,
		outter:         outter,
	}
}
func (j *JobUpdater) UID() types.UID {
	return j.Job.ObjectMeta.UID
}
func (j *JobUpdater) Update(job *paddlev1.TrainingJob) {
	log.Debug("Updating", "job", j.FullName(), "statue", job.Status)
	j.Job = job
}
func (j *JobUpdater) GetJob() *paddlev1.TrainingJob {
	return j.Job
}
func (j *JobUpdater) Delete() error {
	return j.deleteTrainingJob()
}
func (j *JobUpdater) FullName() string {
	return fmt.Sprintf("%s/%s", j.Job.Namespace, j.Job.Name)
}