python 数据流作业在部署后使用 requirements_file 参数后不接受来自 pubsub 订阅的消息

python dataflow job not accepting messages from a pubsub subcription after using requirements_file parameter after while deploying

我想在写入大查询之前使用数据流作业加密来自 pubsub 订阅的消息。我正在使用 pycryptodome==3.9.8, cryptography==3.1 python 库来做到这一点。

在数据流作业中,我使用了以下两个导入

从加密导入随机 从 Crypto.Cipher 导入 AES

当我尝试在没有 --requirements_file 参数的情况下部署数据流管道时。它部署完美,但在向主题发布消息后抛出错误

ModuleNotFoundError: 没有名为 'Crypto' 的模块 [while 运行 'generatedPtransform-81']

之后,我尝试使用 --requirements_file requirement.txt 标志再次部署管道。 数据流管道部署正常,但现在它不接受来自订阅的任何消息。数据流作业没有错误,因为它没有获取消息。

我错过了什么吗?由于没有日志,很难识别。

Re-posting @peter-kim 的评论作为答案:使用 setup.py 文件,你应该能够做你需要的。参见 Dataflow fails when I add requirements.txt [Python]