Exemplo n.º 1
0
func (task *TaskRequest) Encode() (ptr *o.ProtoTaskRequest) {
	ptr = new(o.ProtoTaskRequest)
	ptr.Jobname = &task.job.Score
	ptr.Id = new(uint64)
	*ptr.Id = task.job.Id
	ptr.Parameters = o.ProtoJobParametersFromMap(task.job.Params)

	return ptr
}
Exemplo n.º 2
0
func (resp *TaskResponse) Encode() (ptr *o.ProtoTaskResponse) {
	ptr = new(o.ProtoTaskResponse)

	switch resp.State {
	case RESP_RUNNING:
		ptr.Status = o.ProtoTaskResponse_JOB_INPROGRESS.Enum()
	case RESP_FINISHED:
		ptr.Status = o.ProtoTaskResponse_JOB_SUCCESS.Enum()
	case RESP_FAILED:
		ptr.Status = o.ProtoTaskResponse_JOB_FAILED.Enum()
	case RESP_FAILED_UNKNOWN_SCORE:
		ptr.Status = o.ProtoTaskResponse_JOB_UNKNOWN.Enum()
	case RESP_FAILED_HOST_ERROR:
		ptr.Status = o.ProtoTaskResponse_JOB_HOST_FAILURE.Enum()
	case RESP_FAILED_UNKNOWN:
		ptr.Status = o.ProtoTaskResponse_JOB_UNKNOWN_FAILURE.Enum()
	}
	ptr.Id = new(uint64)
	*ptr.Id = resp.id
	ptr.Response = o.ProtoJobParametersFromMap(resp.Response)

	return ptr
}