объясните, пожалуйста, преждевременно истекающий файл потока и как это исправить - PullRequest
0 голосов
/ 05 декабря 2018

У меня есть поток, в котором я получаю файлы от третьих лиц.Мне нужно подождать, пока все файлы появятся, и как только я сохраню их все в папке, мне придется вызвать процессор (только один раз).созданный таким образом поток, подобный этому.

GetHTTP-> gReadTotalCount -> runGetHTTP in a loop -> save file -> notify-wait (tillTotalCount) -> release all the files -> controlRate (release 1 file) -> the end

1) скорость управления имеет следующие свойства (выпуск 1 файла в минуту) - это то, что я хочу 2), и отношение, входящее в controlRate, имеет файл потокасрок действия установлен на 59 секунд (поэтому все файлы удаляются по мере необходимости)

время ожидания уведомления занимает время (в любом месте от 30 минут до 1 часа) - что функционально нормально.

, нок тому времени, когда все файлы попадают в очередь для controlRate, все файлы удаляются / удаляются.

Я думаю, что возраст ff в очереди - это возраст в этой конкретной очереди, а не полный возраст ff, посколькумомента создания.

Если вы думаете, что поведение правильное, то, похоже, сбивает с толку, как кто-нибудь узнает возраст до посадки в определенную очередь.

Я просто написал небольшой процесс, чтобы показать, что происходит,если вы сохраните атрибут журнала (при остановке) и включите его через 1 минуту, потоковый файл даже не достигнет controlRate, что полностью нарушает мой код.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<template encoding-version="1.2">
    <description></description>
    <groupId>01671244-06f3-1392-593a-e93025e7fe98</groupId>
    <name>testing control flow - dnu</name>
    <snippet>
        <connections>
            <id>c3137278-6c82-3a3a-0000-000000000000</id>
            <parentGroupId>bb618021-2bd4-3942-0000-000000000000</parentGroupId>
            <backPressureDataSizeThreshold>1 GB</backPressureDataSizeThreshold>
            <backPressureObjectThreshold>10000</backPressureObjectThreshold>
            <destination>
                <groupId>bb618021-2bd4-3942-0000-000000000000</groupId>
                <id>d8dcf169-30aa-384d-0000-000000000000</id>
                <type>PROCESSOR</type>
            </destination>
            <flowFileExpiration>59 sec</flowFileExpiration>
            <labelIndex>1</labelIndex>
            <name></name>
            <selectedRelationships>success</selectedRelationships>
            <source>
                <groupId>bb618021-2bd4-3942-0000-000000000000</groupId>
                <id>69cadcc5-6fee-3ce8-0000-000000000000</id>
                <type>PROCESSOR</type>
            </source>
            <zIndex>0</zIndex>
        </connections>
        <connections>
            <id>1ed5ea0a-00a3-3e32-0000-000000000000</id>
            <parentGroupId>bb618021-2bd4-3942-0000-000000000000</parentGroupId>
            <backPressureDataSizeThreshold>1 GB</backPressureDataSizeThreshold>
            <backPressureObjectThreshold>10000</backPressureObjectThreshold>
            <destination>
                <groupId>bb618021-2bd4-3942-0000-000000000000</groupId>
                <id>51f1202e-a045-3ab3-0000-000000000000</id>
                <type>PROCESSOR</type>
            </destination>
            <flowFileExpiration>0 sec</flowFileExpiration>
            <labelIndex>1</labelIndex>
            <name></name>
            <selectedRelationships>success</selectedRelationships>
            <source>
                <groupId>bb618021-2bd4-3942-0000-000000000000</groupId>
                <id>d8dcf169-30aa-384d-0000-000000000000</id>
                <type>PROCESSOR</type>
            </source>
            <zIndex>0</zIndex>
        </connections>
        <connections>
            <id>210554a9-111e-3693-0000-000000000000</id>
            <parentGroupId>bb618021-2bd4-3942-0000-000000000000</parentGroupId>
            <backPressureDataSizeThreshold>1 GB</backPressureDataSizeThreshold>
            <backPressureObjectThreshold>10000</backPressureObjectThreshold>
            <destination>
                <groupId>bb618021-2bd4-3942-0000-000000000000</groupId>
                <id>69cadcc5-6fee-3ce8-0000-000000000000</id>
                <type>PROCESSOR</type>
            </destination>
            <flowFileExpiration>0 sec</flowFileExpiration>
            <labelIndex>1</labelIndex>
            <name></name>
            <selectedRelationships>success</selectedRelationships>
            <source>
                <groupId>bb618021-2bd4-3942-0000-000000000000</groupId>
                <id>d2690b7b-6518-3e94-0000-000000000000</id>
                <type>PROCESSOR</type>
            </source>
            <zIndex>0</zIndex>
        </connections>
        <connections>
            <id>3bfbd1da-ac16-30d3-0000-000000000000</id>
            <parentGroupId>bb618021-2bd4-3942-0000-000000000000</parentGroupId>
            <backPressureDataSizeThreshold>1 GB</backPressureDataSizeThreshold>
            <backPressureObjectThreshold>10000</backPressureObjectThreshold>
            <destination>
                <groupId>bb618021-2bd4-3942-0000-000000000000</groupId>
                <id>ecaf1958-503d-3788-0000-000000000000</id>
                <type>PROCESSOR</type>
            </destination>
            <flowFileExpiration>0 sec</flowFileExpiration>
            <labelIndex>1</labelIndex>
            <name></name>
            <selectedRelationships>failure</selectedRelationships>
            <source>
                <groupId>bb618021-2bd4-3942-0000-000000000000</groupId>
                <id>d8dcf169-30aa-384d-0000-000000000000</id>
                <type>PROCESSOR</type>
            </source>
            <zIndex>0</zIndex>
        </connections>
        <processors>
            <id>d2690b7b-6518-3e94-0000-000000000000</id>
            <parentGroupId>bb618021-2bd4-3942-0000-000000000000</parentGroupId>
            <position>
                <x>570.0000076293945</x>
                <y>68.99999487400055</y>
            </position>
            <bundle>
                <artifact>nifi-standard-nar</artifact>
                <group>org.apache.nifi</group>
                <version>1.6.0</version>
            </bundle>
            <config>
                <bulletinLevel>WARN</bulletinLevel>
                <comments></comments>
                <concurrentlySchedulableTaskCount>1</concurrentlySchedulableTaskCount>
                <descriptors>
                    <entry>
                        <key>File Size</key>
                        <value>
                            <name>File Size</name>
                        </value>
                    </entry>
                    <entry>
                        <key>Batch Size</key>
                        <value>
                            <name>Batch Size</name>
                        </value>
                    </entry>
                    <entry>
                        <key>Data Format</key>
                        <value>
                            <name>Data Format</name>
                        </value>
                    </entry>
                    <entry>
                        <key>Unique FlowFiles</key>
                        <value>
                            <name>Unique FlowFiles</name>
                        </value>
                    </entry>
                    <entry>
                        <key>generate-ff-custom-text</key>
                        <value>
                            <name>generate-ff-custom-text</name>
                        </value>
                    </entry>
                    <entry>
                        <key>character-set</key>
                        <value>
                            <name>character-set</name>
                        </value>
                    </entry>
                </descriptors>
                <executionNode>ALL</executionNode>
                <lossTolerant>false</lossTolerant>
                <penaltyDuration>30 sec</penaltyDuration>
                <properties>
                    <entry>
                        <key>File Size</key>
                        <value>0B</value>
                    </entry>
                    <entry>
                        <key>Batch Size</key>
                        <value>1</value>
                    </entry>
                    <entry>
                        <key>Data Format</key>
                        <value>Text</value>
                    </entry>
                    <entry>
                        <key>Unique FlowFiles</key>
                        <value>false</value>
                    </entry>
                    <entry>
                        <key>generate-ff-custom-text</key>
                    </entry>
                    <entry>
                        <key>character-set</key>
                        <value>UTF-8</value>
                    </entry>
                </properties>
                <runDurationMillis>0</runDurationMillis>
                <schedulingPeriod>1 d</schedulingPeriod>
                <schedulingStrategy>TIMER_DRIVEN</schedulingStrategy>
                <yieldDuration>1 sec</yieldDuration>
            </config>
            <name>GenerateFlowFile</name>
            <relationships>
                <autoTerminate>false</autoTerminate>
                <name>success</name>
            </relationships>
            <state>STOPPED</state>
            <style/>
            <type>org.apache.nifi.processors.standard.GenerateFlowFile</type>
        </processors>
        <processors>
            <id>d8dcf169-30aa-384d-0000-000000000000</id>
            <parentGroupId>bb618021-2bd4-3942-0000-000000000000</parentGroupId>
            <position>
                <x>589.0000076293945</x>
                <y>357.99999487400055</y>
            </position>
            <bundle>
                <artifact>nifi-standard-nar</artifact>
                <group>org.apache.nifi</group>
                <version>1.6.0</version>
            </bundle>
            <config>
                <bulletinLevel>WARN</bulletinLevel>
                <comments></comments>
                <concurrentlySchedulableTaskCount>1</concurrentlySchedulableTaskCount>
                <descriptors>
                    <entry>
                        <key>Rate Control Criteria</key>
                        <value>
                            <name>Rate Control Criteria</name>
                        </value>
                    </entry>
                    <entry>
                        <key>Maximum Rate</key>
                        <value>
                            <name>Maximum Rate</name>
                        </value>
                    </entry>
                    <entry>
                        <key>Rate Controlled Attribute</key>
                        <value>
                            <name>Rate Controlled Attribute</name>
                        </value>
                    </entry>
                    <entry>
                        <key>Time Duration</key>
                        <value>
                            <name>Time Duration</name>
                        </value>
                    </entry>
                    <entry>
                        <key>Grouping Attribute</key>
                        <value>
                            <name>Grouping Attribute</name>
                        </value>
                    </entry>
                </descriptors>
                <executionNode>ALL</executionNode>
                <lossTolerant>false</lossTolerant>
                <penaltyDuration>30 sec</penaltyDuration>
                <properties>
                    <entry>
                        <key>Rate Control Criteria</key>
                        <value>flowfile count</value>
                    </entry>
                    <entry>
                        <key>Maximum Rate</key>
                        <value>1</value>
                    </entry>
                    <entry>
                        <key>Rate Controlled Attribute</key>
                    </entry>
                    <entry>
                        <key>Time Duration</key>
                        <value>1 min</value>
                    </entry>
                    <entry>
                        <key>Grouping Attribute</key>
                    </entry>
                </properties>
                <runDurationMillis>0</runDurationMillis>
                <schedulingPeriod>0 sec</schedulingPeriod>
                <schedulingStrategy>TIMER_DRIVEN</schedulingStrategy>
                <yieldDuration>1 sec</yieldDuration>
            </config>
            <name>ControlRate</name>
            <relationships>
                <autoTerminate>false</autoTerminate>
                <name>failure</name>
            </relationships>
            <relationships>
                <autoTerminate>false</autoTerminate>
                <name>success</name>
            </relationships>
            <state>RUNNING</state>
            <style/>
            <type>org.apache.nifi.processors.standard.ControlRate</type>
        </processors>
        <processors>
            <id>ecaf1958-503d-3788-0000-000000000000</id>
            <parentGroupId>bb618021-2bd4-3942-0000-000000000000</parentGroupId>
            <position>
                <x>1003.9999465942383</x>
                <y>0.0</y>
            </position>
            <bundle>
                <artifact>nifi-standard-nar</artifact>
                <group>org.apache.nifi</group>
                <version>1.6.0</version>
            </bundle>
            <config>
                <bulletinLevel>WARN</bulletinLevel>
                <comments></comments>
                <concurrentlySchedulableTaskCount>1</concurrentlySchedulableTaskCount>
                <descriptors>
                    <entry>
                        <key>Log Level</key>
                        <value>
                            <name>Log Level</name>
                        </value>
                    </entry>
                    <entry>
                        <key>Log Payload</key>
                        <value>
                            <name>Log Payload</name>
                        </value>
                    </entry>
                    <entry>
                        <key>Attributes to Log</key>
                        <value>
                            <name>Attributes to Log</name>
                        </value>
                    </entry>
                    <entry>
                        <key>attributes-to-log-regex</key>
                        <value>
                            <name>attributes-to-log-regex</name>
                        </value>
                    </entry>
                    <entry>
                        <key>Attributes to Ignore</key>
                        <value>
                            <name>Attributes to Ignore</name>
                        </value>
                    </entry>
                    <entry>
                        <key>attributes-to-ignore-regex</key>
                        <value>
                            <name>attributes-to-ignore-regex</name>
                        </value>
                    </entry>
                    <entry>
                        <key>Log prefix</key>
                        <value>
                            <name>Log prefix</name>
                        </value>
                    </entry>
                    <entry>
                        <key>character-set</key>
                        <value>
                            <name>character-set</name>
                        </value>
                    </entry>
                </descriptors>
                <executionNode>ALL</executionNode>
                <lossTolerant>false</lossTolerant>
                <penaltyDuration>30 sec</penaltyDuration>
                <properties>
                    <entry>
                        <key>Log Level</key>
                        <value>info</value>
                    </entry>
                    <entry>
                        <key>Log Payload</key>
                        <value>false</value>
                    </entry>
                    <entry>
                        <key>Attributes to Log</key>
                    </entry>
                    <entry>
                        <key>attributes-to-log-regex</key>
                        <value>.*</value>
                    </entry>
                    <entry>
                        <key>Attributes to Ignore</key>
                    </entry>
                    <entry>
                        <key>attributes-to-ignore-regex</key>
                    </entry>
                    <entry>
                        <key>Log prefix</key>
                    </entry>
                    <entry>
                        <key>character-set</key>
                        <value>UTF-8</value>
                    </entry>
                </properties>
                <runDurationMillis>0</runDurationMillis>
                <schedulingPeriod>0 sec</schedulingPeriod>
                <schedulingStrategy>TIMER_DRIVEN</schedulingStrategy>
                <yieldDuration>1 sec</yieldDuration>
            </config>
            <name>LogAttribute</name>
            <relationships>
                <autoTerminate>false</autoTerminate>
                <name>success</name>
            </relationships>
            <state>STOPPED</state>
            <style/>
            <type>org.apache.nifi.processors.standard.LogAttribute</type>
        </processors>
        <processors>
            <id>51f1202e-a045-3ab3-0000-000000000000</id>
            <parentGroupId>bb618021-2bd4-3942-0000-000000000000</parentGroupId>
            <position>
                <x>1187.0000076293945</x>
                <y>229.99999487400055</y>
            </position>
            <bundle>
                <artifact>nifi-standard-nar</artifact>
                <group>org.apache.nifi</group>
                <version>1.6.0</version>
            </bundle>
            <config>
                <bulletinLevel>WARN</bulletinLevel>
                <comments></comments>
                <concurrentlySchedulableTaskCount>1</concurrentlySchedulableTaskCount>
                <descriptors>
                    <entry>
                        <key>Log Level</key>
                        <value>
                            <name>Log Level</name>
                        </value>
                    </entry>
                    <entry>
                        <key>Log Payload</key>
                        <value>
                            <name>Log Payload</name>
                        </value>
                    </entry>
                    <entry>
                        <key>Attributes to Log</key>
                        <value>
                            <name>Attributes to Log</name>
                        </value>
                    </entry>
                    <entry>
                        <key>attributes-to-log-regex</key>
                        <value>
                            <name>attributes-to-log-regex</name>
                        </value>
                    </entry>
                    <entry>
                        <key>Attributes to Ignore</key>
                        <value>
                            <name>Attributes to Ignore</name>
                        </value>
                    </entry>
                    <entry>
                        <key>attributes-to-ignore-regex</key>
                        <value>
                            <name>attributes-to-ignore-regex</name>
                        </value>
                    </entry>
                    <entry>
                        <key>Log prefix</key>
                        <value>
                            <name>Log prefix</name>
                        </value>
                    </entry>
                    <entry>
                        <key>character-set</key>
                        <value>
                            <name>character-set</name>
                        </value>
                    </entry>
                </descriptors>
                <executionNode>ALL</executionNode>
                <lossTolerant>false</lossTolerant>
                <penaltyDuration>30 sec</penaltyDuration>
                <properties>
                    <entry>
                        <key>Log Level</key>
                        <value>info</value>
                    </entry>
                    <entry>
                        <key>Log Payload</key>
                        <value>false</value>
                    </entry>
                    <entry>
                        <key>Attributes to Log</key>
                    </entry>
                    <entry>
                        <key>attributes-to-log-regex</key>
                        <value>.*</value>
                    </entry>
                    <entry>
                        <key>Attributes to Ignore</key>
                    </entry>
                    <entry>
                        <key>attributes-to-ignore-regex</key>
                    </entry>
                    <entry>
                        <key>Log prefix</key>
                    </entry>
                    <entry>
                        <key>character-set</key>
                        <value>UTF-8</value>
                    </entry>
                </properties>
                <runDurationMillis>0</runDurationMillis>
                <schedulingPeriod>0 sec</schedulingPeriod>
                <schedulingStrategy>TIMER_DRIVEN</schedulingStrategy>
                <yieldDuration>1 sec</yieldDuration>
            </config>
            <name>LogAttribute</name>
            <relationships>
                <autoTerminate>false</autoTerminate>
                <name>success</name>
            </relationships>
            <state>STOPPED</state>
            <style/>
            <type>org.apache.nifi.processors.standard.LogAttribute</type>
        </processors>
        <processors>
            <id>69cadcc5-6fee-3ce8-0000-000000000000</id>
            <parentGroupId>bb618021-2bd4-3942-0000-000000000000</parentGroupId>
            <position>
                <x>0.0</x>
                <y>221.9999796152115</y>
            </position>
            <bundle>
                <artifact>nifi-standard-nar</artifact>
                <group>org.apache.nifi</group>
                <version>1.6.0</version>
            </bundle>
            <config>
                <bulletinLevel>WARN</bulletinLevel>
                <comments></comments>
                <concurrentlySchedulableTaskCount>1</concurrentlySchedulableTaskCount>
                <descriptors>
                    <entry>
                        <key>Log Level</key>
                        <value>
                            <name>Log Level</name>
                        </value>
                    </entry>
                    <entry>
                        <key>Log Payload</key>
                        <value>
                            <name>Log Payload</name>
                        </value>
                    </entry>
                    <entry>
                        <key>Attributes to Log</key>
                        <value>
                            <name>Attributes to Log</name>
                        </value>
                    </entry>
                    <entry>
                        <key>attributes-to-log-regex</key>
                        <value>
                            <name>attributes-to-log-regex</name>
                        </value>
                    </entry>
                    <entry>
                        <key>Attributes to Ignore</key>
                        <value>
                            <name>Attributes to Ignore</name>
                        </value>
                    </entry>
                    <entry>
                        <key>attributes-to-ignore-regex</key>
                        <value>
                            <name>attributes-to-ignore-regex</name>
                        </value>
                    </entry>
                    <entry>
                        <key>Log prefix</key>
                        <value>
                            <name>Log prefix</name>
                        </value>
                    </entry>
                    <entry>
                        <key>character-set</key>
                        <value>
                            <name>character-set</name>
                        </value>
                    </entry>
                </descriptors>
                <executionNode>ALL</executionNode>
                <lossTolerant>false</lossTolerant>
                <penaltyDuration>30 sec</penaltyDuration>
                <properties>
                    <entry>
                        <key>Log Level</key>
                        <value>info</value>
                    </entry>
                    <entry>
                        <key>Log Payload</key>
                        <value>false</value>
                    </entry>
                    <entry>
                        <key>Attributes to Log</key>
                    </entry>
                    <entry>
                        <key>attributes-to-log-regex</key>
                        <value>.*</value>
                    </entry>
                    <entry>
                        <key>Attributes to Ignore</key>
                    </entry>
                    <entry>
                        <key>attributes-to-ignore-regex</key>
                    </entry>
                    <entry>
                        <key>Log prefix</key>
                    </entry>
                    <entry>
                        <key>character-set</key>
                        <value>UTF-8</value>
                    </entry>
                </properties>
                <runDurationMillis>0</runDurationMillis>
                <schedulingPeriod>0 sec</schedulingPeriod>
                <schedulingStrategy>TIMER_DRIVEN</schedulingStrategy>
                <yieldDuration>1 sec</yieldDuration>
            </config>
            <name>LogAttribute</name>
            <relationships>
                <autoTerminate>false</autoTerminate>
                <name>success</name>
            </relationships>
            <state>STOPPED</state>
            <style/>
            <type>org.apache.nifi.processors.standard.LogAttribute</type>
        </processors>
    </snippet>
    <timestamp>12/05/2018 04:20:47 UTC</timestamp>
</template>
...