Java Code Examples for org.apache.nifi.controller.status.ProcessorStatus#setGroupId()
The following examples show how to use
org.apache.nifi.controller.status.ProcessorStatus#setGroupId() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestNiFiFlowAnalyzer.java From nifi with Apache License 2.0 | 5 votes |
private ProcessorStatus createProcessor(ProcessGroupStatus pgStatus, String type) { final ProcessorStatus processor = new ProcessorStatus(); processor.setName(type); processor.setId(nextComponentId()); processor.setGroupId(pgStatus.getId()); pgStatus.getProcessorStatus().add(processor); return processor; }
Example 2
Source File: FlowController.java From localization_nifi with Apache License 2.0 | 4 votes |
private ProcessorStatus getProcessorStatus(final RepositoryStatusReport report, final ProcessorNode procNode, final Predicate<Authorizable> isAuthorized) { final boolean isProcessorAuthorized = isAuthorized.evaluate(procNode); final ProcessorStatus status = new ProcessorStatus(); status.setId(procNode.getIdentifier()); status.setGroupId(procNode.getProcessGroup().getIdentifier()); status.setName(isProcessorAuthorized ? procNode.getName() : procNode.getIdentifier()); status.setType(isProcessorAuthorized ? procNode.getComponentType() : "Processor"); final FlowFileEvent entry = report.getReportEntries().get(procNode.getIdentifier()); if (entry == null) { status.setInputBytes(0L); status.setInputCount(0); status.setOutputBytes(0L); status.setOutputCount(0); status.setBytesWritten(0L); status.setBytesRead(0L); status.setProcessingNanos(0); status.setInvocations(0); status.setAverageLineageDuration(0L); status.setFlowFilesRemoved(0); } else { final int processedCount = entry.getFlowFilesOut(); final long numProcessedBytes = entry.getContentSizeOut(); status.setOutputBytes(numProcessedBytes); status.setOutputCount(processedCount); final int inputCount = entry.getFlowFilesIn(); final long inputBytes = entry.getContentSizeIn(); status.setInputBytes(inputBytes); status.setInputCount(inputCount); final long readBytes = entry.getBytesRead(); status.setBytesRead(readBytes); final long writtenBytes = entry.getBytesWritten(); status.setBytesWritten(writtenBytes); status.setProcessingNanos(entry.getProcessingNanoseconds()); status.setInvocations(entry.getInvocations()); status.setAverageLineageDuration(entry.getAverageLineageMillis()); status.setFlowFilesReceived(entry.getFlowFilesReceived()); status.setBytesReceived(entry.getBytesReceived()); status.setFlowFilesSent(entry.getFlowFilesSent()); status.setBytesSent(entry.getBytesSent()); status.setFlowFilesRemoved(entry.getFlowFilesRemoved()); } // Determine the run status and get any validation error... only validating while STOPPED // is a trade-off we are willing to make, even though processor validity could change due to // environmental conditions (property configured with a file path and the file being externally // removed). This saves on validation costs that would be unnecessary most of the time. if (ScheduledState.DISABLED.equals(procNode.getScheduledState())) { status.setRunStatus(RunStatus.Disabled); } else if (ScheduledState.RUNNING.equals(procNode.getScheduledState())) { status.setRunStatus(RunStatus.Running); } else if (!procNode.isValid()) { status.setRunStatus(RunStatus.Invalid); } else { status.setRunStatus(RunStatus.Stopped); } status.setActiveThreadCount(processScheduler.getActiveThreadCount(procNode)); return status; }
Example 3
Source File: StandardEventAccess.java From nifi with Apache License 2.0 | 4 votes |
private ProcessorStatus getProcessorStatus(final FlowFileEvent flowFileEvent, final ProcessorNode procNode, final Predicate<Authorizable> isAuthorized) { final boolean isProcessorAuthorized = isAuthorized.evaluate(procNode); final ProcessScheduler processScheduler = flowController.getProcessScheduler(); final ProcessorStatus status = new ProcessorStatus(); status.setId(procNode.getIdentifier()); status.setGroupId(procNode.getProcessGroup().getIdentifier()); status.setName(isProcessorAuthorized ? procNode.getName() : procNode.getIdentifier()); status.setType(isProcessorAuthorized ? procNode.getComponentType() : "Processor"); if (flowFileEvent != null && flowFileEvent != EmptyFlowFileEvent.INSTANCE) { final int processedCount = flowFileEvent.getFlowFilesOut(); final long numProcessedBytes = flowFileEvent.getContentSizeOut(); status.setOutputBytes(numProcessedBytes); status.setOutputCount(processedCount); final int inputCount = flowFileEvent.getFlowFilesIn(); final long inputBytes = flowFileEvent.getContentSizeIn(); status.setInputBytes(inputBytes); status.setInputCount(inputCount); final long readBytes = flowFileEvent.getBytesRead(); status.setBytesRead(readBytes); final long writtenBytes = flowFileEvent.getBytesWritten(); status.setBytesWritten(writtenBytes); status.setProcessingNanos(flowFileEvent.getProcessingNanoseconds()); status.setInvocations(flowFileEvent.getInvocations()); status.setAverageLineageDuration(flowFileEvent.getAverageLineageMillis()); status.setFlowFilesReceived(flowFileEvent.getFlowFilesReceived()); status.setBytesReceived(flowFileEvent.getBytesReceived()); status.setFlowFilesSent(flowFileEvent.getFlowFilesSent()); status.setBytesSent(flowFileEvent.getBytesSent()); status.setFlowFilesRemoved(flowFileEvent.getFlowFilesRemoved()); if (isProcessorAuthorized) { status.setCounters(flowFileEvent.getCounters()); } } // Determine the run status and get any validation error... only validating while STOPPED // is a trade-off we are willing to make, even though processor validity could change due to // environmental conditions (property configured with a file path and the file being externally // removed). This saves on validation costs that would be unnecessary most of the time. if (ScheduledState.DISABLED.equals(procNode.getScheduledState())) { status.setRunStatus(RunStatus.Disabled); } else if (ScheduledState.RUNNING.equals(procNode.getScheduledState())) { status.setRunStatus(RunStatus.Running); } else if (procNode.getValidationStatus() == ValidationStatus.VALIDATING) { status.setRunStatus(RunStatus.Validating); } else if (procNode.getValidationStatus() == ValidationStatus.INVALID) { status.setRunStatus(RunStatus.Invalid); } else { status.setRunStatus(RunStatus.Stopped); } status.setExecutionNode(procNode.getExecutionNode()); status.setTerminatedThreadCount(procNode.getTerminatedThreadCount()); status.setActiveThreadCount(processScheduler.getActiveThreadCount(procNode)); return status; }