func ThriftRunStatusToDomain()

in worker/domain/api.go [105:149]


func ThriftRunStatusToDomain(thrift *worker.RunStatus) runner.RunStatus {
	domain := runner.RunStatus{}
	domain.RunID = runner.RunID(thrift.RunId)
	switch thrift.Status {
	case worker.Status_UNKNOWN:
		domain.State = runner.UNKNOWN
	case worker.Status_PENDING:
		domain.State = runner.PENDING
	case worker.Status_RUNNING:
		domain.State = runner.RUNNING
	case worker.Status_COMPLETE:
		domain.State = runner.COMPLETE
	case worker.Status_FAILED:
		domain.State = runner.FAILED
	case worker.Status_ABORTED:
		domain.State = runner.ABORTED
	case worker.Status_TIMEDOUT:
		domain.State = runner.TIMEDOUT
	}
	if thrift.OutUri != nil {
		domain.StdoutRef = *thrift.OutUri
	}
	if thrift.ErrUri != nil {
		domain.StderrRef = *thrift.ErrUri
	}
	if thrift.Error != nil {
		domain.Error = *thrift.Error
	}
	if thrift.ExitCode != nil {
		domain.ExitCode = errors.ExitCode(*thrift.ExitCode)
	}
	if thrift.SnapshotId != nil {
		domain.SnapshotID = *thrift.SnapshotId
	}
	if thrift.JobId != nil {
		domain.JobID = *thrift.JobId
	}
	if thrift.TaskId != nil {
		domain.TaskID = *thrift.TaskId
	}
	if thrift.Tag != nil {
		domain.Tag = *thrift.Tag
	}
	return domain
}