func ResponseFromProto(ptr *o.TaskResponse) (r *TaskResponse) { r = new(TaskResponse) switch ptr.Status { case o.TaskStatus_InProgress: r.State = RESP_RUNNING case o.TaskStatus_Success: r.State = RESP_FINISHED case o.TaskStatus_Failed: r.State = RESP_FAILED case o.TaskStatus_HostFailure: r.State = RESP_FAILED_HOST_ERROR case o.TaskStatus_Unknown: r.State = RESP_FAILED_UNKNOWN_SCORE case o.TaskStatus_UnknownFailure: fallthrough default: r.State = RESP_FAILED_UNKNOWN } r.id = ptr.Id r.Response = o.CopyMap(ptr.Response) return r }
/* Map a wire task to an internal Task Request. */ func TaskFromProto(ptr *o.TaskRequest) (t *TaskRequest) { t = NewTaskRequest() t.Score = ptr.JobName t.Id = ptr.Id t.Params = o.CopyMap(ptr.Parameters) return t }
func (resp *TaskResponse) Encode() (ptr *o.TaskResponse) { ptr = new(o.TaskResponse) switch resp.State { case RESP_RUNNING: ptr.Status = o.TaskStatus_InProgress case RESP_FINISHED: ptr.Status = o.TaskStatus_Success case RESP_FAILED: ptr.Status = o.TaskStatus_Failed case RESP_FAILED_UNKNOWN_SCORE: ptr.Status = o.TaskStatus_Unknown case RESP_FAILED_HOST_ERROR: ptr.Status = o.TaskStatus_HostFailure case RESP_FAILED_UNKNOWN: ptr.Status = o.TaskStatus_UnknownFailure } ptr.Id = resp.id ptr.Response = o.CopyMap(resp.Response) return ptr }