use of org.apache.nifi.controller.status.ProcessGroupStatus in project nifi by apache.
the class ControllerFacade method getInputPortStatus.
/**
* Gets the status for the specified input port.
*
* @param portId input port id
* @return the status for the specified input port
*/
public PortStatus getInputPortStatus(final String portId) {
final ProcessGroup root = flowController.getGroup(flowController.getRootGroupId());
final Port port = root.findInputPort(portId);
// ensure the input port was found
if (port == null) {
throw new ResourceNotFoundException(String.format("Unable to locate input port with id '%s'.", portId));
}
final String groupId = port.getProcessGroup().getIdentifier();
final ProcessGroupStatus processGroupStatus = flowController.getGroupStatus(groupId, NiFiUserUtils.getNiFiUser());
if (processGroupStatus == null) {
throw new ResourceNotFoundException(String.format("Unable to locate group with id '%s'.", groupId));
}
final PortStatus status = processGroupStatus.getInputPortStatus().stream().filter(portStatus -> portId.equals(portStatus.getId())).findFirst().orElse(null);
if (status == null) {
throw new ResourceNotFoundException(String.format("Unable to locate input port with id '%s'.", portId));
}
return status;
}
use of org.apache.nifi.controller.status.ProcessGroupStatus in project nifi by apache.
the class ControllerFacade method getProcessorStatus.
/**
* Gets the status for the specified processor.
*
* @param processorId processor id
* @return the status for the specified processor
*/
public ProcessorStatus getProcessorStatus(final String processorId) {
final ProcessGroup root = flowController.getGroup(flowController.getRootGroupId());
final ProcessorNode processor = root.findProcessor(processorId);
// ensure the processor was found
if (processor == null) {
throw new ResourceNotFoundException(String.format("Unable to locate processor with id '%s'.", processorId));
}
// calculate the process group status
final String groupId = processor.getProcessGroup().getIdentifier();
final ProcessGroupStatus processGroupStatus = flowController.getGroupStatus(groupId, NiFiUserUtils.getNiFiUser());
if (processGroupStatus == null) {
throw new ResourceNotFoundException(String.format("Unable to locate group with id '%s'.", groupId));
}
final ProcessorStatus status = processGroupStatus.getProcessorStatus().stream().filter(processorStatus -> processorId.equals(processorStatus.getId())).findFirst().orElse(null);
if (status == null) {
throw new ResourceNotFoundException(String.format("Unable to locate processor with id '%s'.", processorId));
}
return status;
}
use of org.apache.nifi.controller.status.ProcessGroupStatus in project nifi by apache.
the class ControllerFacade method getRemoteProcessGroupStatus.
/**
* Gets the status for the specified remote process group.
*
* @param remoteProcessGroupId remote process group id
* @return the status for the specified remote process group
*/
public RemoteProcessGroupStatus getRemoteProcessGroupStatus(final String remoteProcessGroupId) {
final ProcessGroup root = flowController.getGroup(flowController.getRootGroupId());
final RemoteProcessGroup remoteProcessGroup = root.findRemoteProcessGroup(remoteProcessGroupId);
// ensure the output port was found
if (remoteProcessGroup == null) {
throw new ResourceNotFoundException(String.format("Unable to locate remote process group with id '%s'.", remoteProcessGroupId));
}
final String groupId = remoteProcessGroup.getProcessGroup().getIdentifier();
final ProcessGroupStatus groupStatus = flowController.getGroupStatus(groupId, NiFiUserUtils.getNiFiUser());
if (groupStatus == null) {
throw new ResourceNotFoundException(String.format("Unable to locate group with id '%s'.", groupId));
}
final RemoteProcessGroupStatus status = groupStatus.getRemoteProcessGroupStatus().stream().filter(rpgStatus -> remoteProcessGroupId.equals(rpgStatus.getId())).findFirst().orElse(null);
if (status == null) {
throw new ResourceNotFoundException(String.format("Unable to locate remote process group with id '%s'.", remoteProcessGroupId));
}
return status;
}
use of org.apache.nifi.controller.status.ProcessGroupStatus in project nifi by apache.
the class TestDataDogReportingTask method initProcessGroupStatus.
private void initProcessGroupStatus() {
status = new ProcessGroupStatus();
status.setId("1234");
status.setFlowFilesReceived(5);
status.setBytesReceived(10000);
status.setFlowFilesSent(10);
status.setBytesSent(20000);
status.setQueuedCount(100);
status.setQueuedContentSize(1024L);
status.setBytesRead(60000L);
status.setBytesWritten(80000L);
status.setActiveThreadCount(5);
status.setInputCount(2);
status.setOutputCount(4);
}
use of org.apache.nifi.controller.status.ProcessGroupStatus in project nifi by apache.
the class TestDataDogReportingTask method initProcessorStatuses.
private void initProcessorStatuses() {
procStatus = new ProcessorStatus();
procStatus.setProcessingNanos(123456789);
procStatus.setInputCount(2);
procStatus.setOutputCount(4);
procStatus.setActiveThreadCount(6);
procStatus.setBytesSent(1256);
procStatus.setName("sampleProcessor");
Collection<ProcessorStatus> processorStatuses = new ArrayList<>();
processorStatuses.add(procStatus);
status.setProcessorStatus(processorStatuses);
ProcessGroupStatus groupStatus = new ProcessGroupStatus();
groupStatus.setProcessorStatus(processorStatuses);
Collection<ProcessGroupStatus> groupStatuses = new ArrayList<>();
groupStatuses.add(groupStatus);
status.setProcessGroupStatus(groupStatuses);
}
Aggregations