Я пересоздал ваш сценарий и получил ту же ошибку, что и вы, в версии ApacheBeam SDK 2.20.0
. Когда я сменил версию на 2.16.0
и 2.19.0
, она начала работать без проблем.
Вот так выглядит мой setup.py
файл:
from __future__ import absolute_import
from __future__ import print_function
import subprocess
from distutils.command.build import build as _build
import setuptools
CUSTOM_COMMANDS = [['apt-get', 'update'],
['apt-get', '--assume-yes', 'install', 'unzip'],
['apt-get', '--assume-yes', 'install', 'default-jre'],
['apt-get', '--assume-yes', 'install', 'perl']]
class CustomCommands(setuptools.Command):
"""A setuptools Command class able to run arbitrary commands."""
def initialize_options(self):
pass
def finalize_options(self):
pass
def RunCustomCommand(self, command_list):
print
'Running command: %s' % command_list
p = subprocess.Popen(
command_list,
stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
# Can use communicate(input='y\n'.encode()) if the command run requires
# some confirmation.
stdout_data, _ = p.communicate()
print
'Command output: %s' % stdout_data
if p.returncode != 0:
raise RuntimeError(
'Command %s failed: exit code: %s' % (command_list, p.returncode))
def run(self):
for command in CUSTOM_COMMANDS:
self.RunCustomCommand(command)
REQUIRED_PACKAGES = [
]
PACKAGE_NAME = 'my_package'
PACKAGE_VERSION = '0.0.1'
setuptools.setup(
name=PACKAGE_NAME,
version=PACKAGE_VERSION,
description='Test project',
install_requires=REQUIRED_PACKAGES,
packages=setuptools.find_packages(),
cmdclass={
'build': build,
'CustomCommands': CustomCommands,
}
)
В настоящее время обходной путь - использовать более старую версию ApacheBeam SDK
. Я считаю, что в ApacheBeam SDK 2.20.0
есть ошибка, вы можете заполнить форму , чтобы сообщить об ошибке в IssueTracker.
Надеюсь, вы найдете приведенные выше сведения полезными.