當前位置: 首頁>>代碼示例>>Golang>>正文


Golang Job.State方法代碼示例

本文整理匯總了Golang中github.com/coreos/fleet/job.Job.State方法的典型用法代碼示例。如果您正苦於以下問題:Golang Job.State方法的具體用法?Golang Job.State怎麽用?Golang Job.State使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/coreos/fleet/job.Job的用法示例。


在下文中一共展示了Job.State方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: hydrateJob

func (r *EtcdRegistry) hydrateJob(j *job.Job) (err error) {
	j.TargetState, err = r.jobTargetState(j.Name)
	if err != nil {
		return
	}

	j.TargetMachineID, err = r.jobTargetMachine(j.Name)
	if err != nil {
		return
	}

	j.UnitState = r.getUnitState(j.Name)
	j.State = r.determineJobState(j.Name)

	return
}
開發者ID:Jitendrakry,項目名稱:fleet,代碼行數:16,代碼來源:job.go

示例2: hydrateJob

func (r *EtcdRegistry) hydrateJob(j *job.Job) error {
	tgt, err := r.jobTargetState(j.Name)
	if err != nil {
		return err
	}

	j.TargetState = tgt

	j.TargetMachineID, err = r.jobTargetMachine(j.Name)
	if err != nil {
		return err
	}

	j.UnitState = r.getUnitState(j.Name)
	j.State = r.determineJobState(j.Name)

	return nil
}
開發者ID:JuanCarlosM,項目名稱:fleet,代碼行數:18,代碼來源:job.go

示例3: newClusterState

func newClusterState(units []job.Unit, sUnits []job.ScheduledUnit, machines []machine.MachineState) *clusterState {
	sUnitMap := make(map[string]*job.ScheduledUnit)
	for _, sUnit := range sUnits {
		sUnit := sUnit
		sUnitMap[sUnit.Name] = &sUnit
	}

	jMap := make(map[string]*job.Job)
	guMap := make(map[string]*job.Unit)
	for _, u := range units {
		if u.IsGlobal() {
			u := u
			guMap[u.Name] = &u
		} else {
			j := job.Job{
				Name:        u.Name,
				Unit:        u.Unit,
				TargetState: u.TargetState,
			}

			if sUnit, ok := sUnitMap[u.Name]; ok {
				j.TargetMachineID = sUnit.TargetMachineID
				j.State = sUnit.State
			}

			jMap[j.Name] = &j
		}
	}

	mMap := make(map[string]*machine.MachineState, len(machines))
	for _, ms := range machines {
		ms := ms
		mMap[ms.ID] = &ms
	}

	return &clusterState{
		jobs:     jMap,
		gUnits:   guMap,
		machines: mMap,
	}
}
開發者ID:ericcapricorn,項目名稱:fleet,代碼行數:41,代碼來源:state.go

示例4: parseJobDir

func (r *EtcdRegistry) parseJobDir(j *job.Job, dir *etcd.Node) (err error) {
	var heartbeat string
	for _, node := range dir.Nodes {
		switch node.Key {
		case r.jobTargetStatePath(j.Name):
			j.TargetState, err = job.ParseJobState(node.Value)
			if err != nil {
				return
			}
		case r.jobTargetAgentPath(j.Name):
			j.TargetMachineID = node.Value
		case r.jobHeartbeatPath(j.Name):
			heartbeat = node.Value
		}
	}

	j.UnitState = r.getUnitState(j.Name)

	js := determineJobState(j, heartbeat)
	j.State = &js

	return
}
開發者ID:BillTheBest,項目名稱:fleet,代碼行數:23,代碼來源:job.go


注:本文中的github.com/coreos/fleet/job.Job.State方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。