Пример #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
}
Пример #2
0
func (tr *TaskRunner) reportLocalExecutorStatusOnce() {
	scheduler.RemoteDirectCommand(tr.option.TaskTlsConfig, tr.option.AgentAddress, &cmd.ControlMessage{
		Type: cmd.ControlMessage_LocalStatusReportRequest.Enum(),
		LocalStatusReportRequest: &cmd.LocalStatusReportRequest{
			StartRequestHash: proto.Uint32(uint32(tr.option.RequestId)),
			InputStatuses:    ToProto(tr.executorStatus.InputChannelStatuses),
			OutputStatuses:   ToProto(tr.executorStatus.OutputChannelStatuses),
		},
	})
}
Пример #3
0
func (tr *TaskRunner) reportLocalExecutorStatusOnce() {
	scheduler.RemoteDirectCommand(fmt.Sprintf("localhost:%d", netchan.Option.AgentPort), &cmd.ControlMessage{
		Type: cmd.ControlMessage_LocalStatusReportRequest.Enum(),
		LocalStatusReportRequest: &cmd.LocalStatusReportRequest{
			StartRequestHash: proto.Uint32(uint32(tr.option.RequestId)),
			InputStatuses:    ToProto(tr.executorStatus.InputChannelStatuses),
			OutputStatuses:   ToProto(tr.executorStatus.OutputChannelStatuses),
		},
	})
}
Пример #4
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
}
Пример #5
0
func askExecutorToStopRequest(tlsConfig *tls.Config, server string, requestId uint32) (err error) {
	_, err = scheduler.RemoteDirectCommand(tlsConfig, server, scheduler.NewStopRequest(requestId))
	return
}