コード例 #1
0
ファイル: task_response.go プロジェクト: anchor/orchestra
func ResponseFromProto(ptr *o.ProtoTaskResponse) (r *TaskResponse) {
	r = new(TaskResponse)

	switch *(ptr.Status) {
	case o.ProtoTaskResponse_JOB_INPROGRESS:
		r.State = RESP_RUNNING
	case o.ProtoTaskResponse_JOB_SUCCESS:
		r.State = RESP_FINISHED
	case o.ProtoTaskResponse_JOB_FAILED:
		r.State = RESP_FAILED
	case o.ProtoTaskResponse_JOB_HOST_FAILURE:
		r.State = RESP_FAILED_HOST_ERROR
	case o.ProtoTaskResponse_JOB_UNKNOWN:
		r.State = RESP_FAILED_UNKNOWN_SCORE
	case o.ProtoTaskResponse_JOB_UNKNOWN_FAILURE:
		fallthrough
	default:
		r.State = RESP_FAILED_UNKNOWN
	}

	r.id = *(ptr.Id)
	r.Response = o.MapFromProtoJobParameters(ptr.Response)

	return r
}
コード例 #2
0
ファイル: task_request.go プロジェクト: anchor/orchestra
/* Map a wire task to an internal Task Request.
 */
func TaskFromProto(ptr *o.ProtoTaskRequest) (t *TaskRequest) {
	t = NewTaskRequest()

	t.Score = *(ptr.Jobname)
	t.Id = *(ptr.Id)
	t.Params = o.MapFromProtoJobParameters(ptr.Parameters)

	return t
}