数据流作业失败,输出属性丢失错误

时间:2018-05-10 09:28:01

标签: google-cloud-platform google-cloud-dataflow

虽然将输出参数作为参数传递,但数据流管道作业失败并且消息输出属性丢失。

错误:

Exception in thread "main" java.lang.IllegalArgumentException: Class interface org.apache.beam.runners.dataflow.options.DataflowPipelineOptions missing a property named 'output'.
    at org.apache.beam.sdk.options.PipelineOptionsFactory.parseObjects(PipelineOptionsFactory.java:1483)
    at org.apache.beam.sdk.options.PipelineOptionsFactory.access$400(PipelineOptionsFactory.java:110)
    at org.apache.beam.sdk.options.PipelineOptionsFactory$Builder.as(PipelineOptionsFactory.java:297)
    at com.example.DataValidationPipeline.getOptions(DataValidationPipeline.java:36)
    at com.example.DataValidationPipeline.main(DataValidationPipeline.java:50)

2 个答案:

答案 0 :(得分:1)

此错误消息可能更清晰。它应显示为:“未知标志:--output”。

我最近在基于wordcount示例的管道上删除了 class NsdHelper(private var mContext: Context, private val createClient: (InetAddress, Int)->Unit, val mHandler: Handler) { internal var mNsdManager: NsdManager = mContext.getSystemService(Context.NSD_SERVICE) as NsdManager internal lateinit var mResolveListener: NsdManager.ResolveListener private var mDiscoveryListener: NsdManager.DiscoveryListener? = null private var mRegistrationListener: NsdManager.RegistrationListener? = null var mServiceName = "Wizard" var chosenServiceInfo: NsdServiceInfo? = null internal set val mServices = mutableListOf<NsdServiceInfo>() fun initializeNsd() { stopDiscovery() tearDown() initializeResolveListener() } fun reset(){ initializeResolveListener() discoverServices() } fun initializeDiscoveryListener() { mDiscoveryListener = object : NsdManager.DiscoveryListener { override fun onDiscoveryStarted(regType: String) { Log.d(TAG, "Service discovery started") } override fun onServiceFound(service: NsdServiceInfo) { Log.d(TAG, "Service discovery success$service") when { service.serviceType != SERVICE_TYPE -> Log.d(TAG, "Unknown Service Type: " + service.serviceType) service.serviceName == mServiceName -> Log.d(TAG, "Same machine: $mServiceName") service.serviceName.contains("Verzauberte") -> { if (mServices.none { it.serviceName == service.serviceName }) mNsdManager.resolveService(service, mResolveListener) } } } override fun onServiceLost(service: NsdServiceInfo) { Log.e(TAG, "service lost$service") } override fun onDiscoveryStopped(serviceType: String) { Log.i(TAG, "Discovery stopped: $serviceType") } override fun onStartDiscoveryFailed(serviceType: String, errorCode: Int) { Log.e(TAG, "Discovery failed: Error code:$errorCode") } override fun onStopDiscoveryFailed(serviceType: String, errorCode: Int) { Log.e(TAG, "Discovery failed: Error code:$errorCode") } } } fun initializeResolveListener() { mResolveListener = object : NsdManager.ResolveListener { override fun onResolveFailed(serviceInfo: NsdServiceInfo, errorCode: Int) { Log.e(TAG, "Resolve failed$errorCode") } override fun onServiceResolved(serviceInfo: NsdServiceInfo) { Log.e(TAG, "Resolve Succeeded. $serviceInfo") if (serviceInfo.serviceName == mServiceName) { Log.d(TAG, "Same IP.") return } chosenServiceInfo = serviceInfo mHandler.post(Runnable { createClient( serviceInfo.host, serviceInfo.port ) }) mServices.add(serviceInfo) reset() } } } fun initializeRegistrationListener() { mRegistrationListener = object : NsdManager.RegistrationListener { override fun onServiceRegistered(NsdServiceInfo: NsdServiceInfo) { mServiceName = NsdServiceInfo.serviceName Log.d(TAG, "Service registered: $mServiceName") } override fun onRegistrationFailed(arg0: NsdServiceInfo, arg1: Int) { Log.d(TAG, "Service registration failed: $arg1") } override fun onServiceUnregistered(arg0: NsdServiceInfo) { Log.d(TAG, "Service unregistered: " + arg0.serviceName) } override fun onUnregistrationFailed(serviceInfo: NsdServiceInfo, errorCode: Int) { Log.d(TAG, "Service unregistration failed: $errorCode") } } } fun registerService(port: Int) { tearDown() // Cancel any previous registration request initializeRegistrationListener() val serviceInfo = NsdServiceInfo().apply { serviceType = SERVICE_TYPE serviceName = "Verzauberte[$port]" setPort(port) } mNsdManager.registerService( serviceInfo, NsdManager.PROTOCOL_DNS_SD, mRegistrationListener ) } fun discoverServices() { stopDiscovery() // Cancel any existing discovery request initializeDiscoveryListener() Log.d(this.toString(), "Start discovering") mNsdManager.discoverServices( SERVICE_TYPE, NsdManager.PROTOCOL_DNS_SD, mDiscoveryListener ) } fun stopDiscovery() { if (mDiscoveryListener != null) { try { mNsdManager.stopServiceDiscovery(mDiscoveryListener) } finally { } mDiscoveryListener = null } } fun tearDown() { if (mRegistrationListener != null) { try { mNsdManager.unregisterService(mRegistrationListener) } finally { } mRegistrationListener = null } } companion object { val SERVICE_TYPE = "_votinginteractions._tcp." val TAG = "NsdHelper" } 类时遇到了类似的错误。用于运行单词计数的命令行包括WordCountOptions。删除-Dexec.args="--output=something",它应该对您有用。

答案 1 :(得分:0)

似乎正在发生的情况是输出文件可能未正确设置。我建议查看this文档,从中可以看到在构建和运行数据流管道时,您需要在命令中设置输出参数,如下所示:

  mvn compile exec:java \
  -Dexec.mainClass=com.example.WordCount \
  -Dexec.args="--project=<my-cloud-project> \
  --stagingLocation=gs://<my-wordcount-storage-bucket>/staging/ \
  --output=gs://<my-wordcount-storage-bucket>/output \
  --runner=DataflowRunner"

这是假设您正在使用maven,如果您正在使用eclipse,则可以查看this文档。