2017-06-14 16 views
0

在DirectRunner上測試了我的管道,並且一切正常。 現在我想在DataflowRunner上運行它。它不起作用。它甚至在輸入我的管道代碼之前就失敗了,我完全被stackdriver中的日誌所淹沒 - 只是不明白它們的意思,並且沒有任何線索。數據流未能設置工作人員

  • 執行圖看起來加載罰款
  • 工作池開始和1名工人試圖通過安裝過程中運行,但看起來永遠不會成功
  • 一些日誌,我猜可能提供有用的信息,以便進行調試:

    AttributeError:'module' object has no attribute 'NativeSource' /usr/bin/python failed with exit status 1
    Back-off 20s restarting failed container=python pod=dataflow-fiona-backlog-clean-test2-06140817-1629-harness-3nxh_default(50a3915d6501a3ec74d6d385f70c8353)
    checking backoff for container "python" in pod "dataflow-fiona-backlog-clean-test2-06140817-1629-harness-3nxh"
    INFO SSH key is not a complete entry: .....

    我應該如何解決這個問題?

編輯: 我setup.py在這裏,如果有幫助:(從 [here]拷入,只修改了REQUIRED_PACKAGESsetuptools.setup部分)

from distutils.command.build import build as _build 
import subprocess 

import setuptools 


# This class handles the pip install mechanism. 
class build(_build): # pylint: disable=invalid-name 
    """A build command class that will be invoked during package install. 

    The package built using the current setup.py will be staged and later 
    installed in the worker using `pip install package'. This class will be 
    instantiated during install for this specific scenario and will trigger 
    running the custom commands specified. 
    """ 
    sub_commands = _build.sub_commands + [('CustomCommands', None)] 


# Some custom command to run during setup. The command is not essential for this 
# workflow. It is used here as an example. Each command will spawn a child 
# process. Typically, these commands will include steps to install non-Python 
# packages. For instance, to install a C++-based library libjpeg62 the following 
# two commands will have to be added: 
# 
#  ['apt-get', 'update'], 
#  ['apt-get', '--assume-yes', install', 'libjpeg62'], 
# 
# First, note that there is no need to use the sudo command because the setup 
# script runs with appropriate access. 
# Second, if apt-get tool is used then the first command needs to be 'apt-get 
# update' so the tool refreshes itself and initializes links to download 
# repositories. Without this initial step the other apt-get install commands 
# will fail with package not found errors. Note also --assume-yes option which 
# shortcuts the interactive confirmation. 
# 
# The output of custom commands (including failures) will be logged in the 
# worker-startup log. 
CUSTOM_COMMANDS = [ 
    ['echo', 'Custom command worked!']] 


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) 


# Configure the required packages and scripts to install. 
# Note that the Python Dataflow containers come with numpy already installed 
# so this dependency will not trigger anything to be installed unless a version 
# restriction is specified. 
REQUIRED_PACKAGES = ['apache-beam==2.0.0', 
        'datalab==1.0.1', 
        'google-cloud==0.19.0', 
        'google-cloud-bigquery==0.22.1', 
        'google-cloud-core==0.22.1', 
        'google-cloud-dataflow==0.6.0', 
        'pandas==0.20.2'] 


setuptools.setup(
    name='geotab-backlog-dataflow', 
    version='0.0.1', 
    install_requires=REQUIRED_PACKAGES, 
    packages=setuptools.find_packages(), 
) 

工人啓動日誌:,它結束於以下例外

I /usr/bin/python failed with exit status 1 
I /usr/bin/python failed with exit status 1 
I AttributeError: 'module' object has no attribute 'NativeSource' 
I  class ConcatSource(iobase.NativeSource): 
I File "/usr/local/lib/python2.7/dist-packages/dataflow_worker/concat_reader.py", line 26, in <module> 
I  from dataflow_worker import concat_reader 
I File "/usr/local/lib/python2.7/dist-packages/dataflow_worker/maptask.py", line 31, in <module> 
I  from dataflow_worker import maptask 
I File "/usr/local/lib/python2.7/dist-packages/dataflow_worker/executor.py", line 26, in <module> 
I  from dataflow_worker import executor 
I File "/usr/local/lib/python2.7/dist-packages/dataflow_worker/batchworker.py", line 63, in <module> 
I  from dataflow_worker import batchworker 
I File "/usr/local/lib/python2.7/dist-packages/dataflow_worker/start.py", line 26, in <module> 
I  exec code in run_globals 
I File "/usr/lib/python2.7/runpy.py", line 72, in _run_code 
I  "__main__", fname, loader, pkg_name) 
I File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main 
I AttributeError: 'module' object has no attribute 'NativeSource' 
I  class ConcatSource(iobase.NativeSource): 
+0

你能分享一份工作ID嗎?在雲日誌記錄中,其他日誌中可能還會有其他信息(例如,worker,worker_startup等),這些信息可能包含有關該工作人員未啓動的詳細信息。 –

+0

@BenChambers JobID:2017-06-13_14_00_46-14992846213167080594,2017-06-14_08_17_20-10061999408051657645。我可以看到工人啓動日誌中的異常。我將它們添加到我的帖子中。 – foxwendy

回答

1

您似乎在您的REQUIRED_PACKAGES指令中使用了不兼容的要求,即您指定的"apache-beam==2.0.0""google-cloud-dataflow==0.6.0"彼此衝突。您可以嘗試移除/卸載"apache-beam"包,並安裝/包含"google-cloud-dataflow==2.0.0"包嗎?

+1

在數據流上工作確實令人沮喪。 Cloud Runner上的原因可能會導致我的本地跑步者無法正常工作。 – foxwendy

+0

這真的很讓人困惑(不是你的答案,而是文檔)每個用於數據流的Google文檔都說它現在基於Apache Beam,並將我引導到Beam網站。另外,如果我尋找github項目,我會看到谷歌數據流項目是空的,只是一切都去apache梁回購。 – foxwendy

+0

是否意味着google-cloud-dataflow已被棄用,我應該安裝apache-beam?另外,我試着卸載apache-beam,只保留google-cloud-dataflow,directrunner中有錯誤:ImportError:沒有名爲options.pipeline_options的模塊。似乎在谷歌雲數據流下,梁包仍然在舊版本,但我只是找不到任何支持API文檔從谷歌解釋版本選擇..... – foxwendy

相關問題