Apache NIFI:无法写入流程内容

问题描述 投票:0回答:1

我有一个 csv 文件,我使用 GetFile Processor 将其提取到 NiFi,然后使用 ConvertRecord Processor 没有任何问题,当我将 ExecuteStreamCommand 拖到画布上运行 python 脚本时,我运行到一些问题来编写文件流。

这是我使用的配置: enter image description here

Python脚本:

import pandas as pd
import sys
from io import StringIO

try:

    # Read input data from the stdin:
    path_file = sys.stdin.read()
    input_df = pd.read_csv(StringIO(path_file))

    # Fill missing values with column means
    input_df.dropna(inplace=True)

    # Write the processed data to the stdout:
    sys.stdout.write(input_df.to_csv(path_file, index=False))

except Exception as e:
    sys.stderr.write("An error occurred: {}".format(str(e)))

enter image description here

如图所示,流程已读取但无法写入下一个处理器,并且我不断收到错误:

由于存档文件大小限制,无法将流文件内容默认写入内容存储库容器;等待存档清理。当前存档的文件总数 = 13

供您参考,我已经尝试禁用 nifi.flow.configuration.archive.enabled=false 并将最大存储大小调整为 10 GB 但无济于事,我一直遇到同样的错误。

我应该怎么做才能解决这个问题?

python apache-nifi
1个回答
0
投票

作为提醒,我找到了问题的原因。 在Python脚本中:

    # Write the processed data to the stdout:
    sys.stdout.write(input_df.to_csv(path_file, index=False))

应删除 path_file 并使用此命令:

    sys.stdout.write(input_df.to_csv(index=False))
© www.soinside.com 2019 - 2024. All rights reserved.