Ejemplo n.º 1
0
func askExecutorStatusForRequest(server string, requestId int32) (*RemoteExecutorStatus, error) {

	reply, err := scheduler.RemoteDirectCommand(server, scheduler.NewGetStatusRequest(requestId))
	if err != nil {
		return nil, err
	}

	response := reply.GetGetStatusResponse()

	var inputStatuses []*util.ChannelStatus
	for _, inputStatus := range response.GetInputStatuses() {
		inputStatuses = append(inputStatuses, &util.ChannelStatus{
			Length:    inputStatus.GetLength(),
			StartTime: time.Unix(inputStatus.GetStartTime(), 0),
			StopTime:  time.Unix(inputStatus.GetStopTime(), 0),
		})
	}

	return &RemoteExecutorStatus{
		ExecutorStatus: ExecutorStatus{
			InputChannelStatuses: inputStatuses,
			OutputChannelStatus: &util.ChannelStatus{
				Length: response.GetOutputStatus().GetLength(),
			},
			RequestTime: time.Unix(response.GetRequestTime(), 0),
			StartTime:   time.Unix(response.GetStartTime(), 0),
			StopTime:    time.Unix(response.GetStopTime(), 0),
		},
	}, nil
}
Ejemplo n.º 2
0
func askExecutorStatusForRequest(tlsConfig *tls.Config, server string, requestId uint32) (*RemoteExecutorStatus, error) {

	reply, err := scheduler.RemoteDirectCommand(tlsConfig, server, scheduler.NewGetStatusRequest(requestId))
	if err != nil {
		return nil, err
	}

	response := reply.GetGetStatusResponse()

	return &RemoteExecutorStatus{
		ExecutorStatus: util.ExecutorStatus{
			InputChannelStatuses:  FromProto(response.GetInputStatuses()),
			OutputChannelStatuses: FromProto(response.GetOutputStatuses()),
			RequestTime:           time.Unix(response.GetRequestTime(), 0),
			StartTime:             time.Unix(response.GetStartTime(), 0),
			StopTime:              time.Unix(response.GetStopTime(), 0),
		},
	}, nil
}