我们有一个从 BigQuery 表读取的管道。调用getF()TableRow 上的方法应该List<TableCell>为该行返回 a 。但它返回null。
为什么getF()返回null?
@Override
public void processElement(ProcessContext c) throws Exception {
TableRow aRow = context.element();
List<TableCell> tableCells = aRow.getF(); //This returns null!
}
Run Code Online (Sandbox Code Playgroud) 当我使用 *DataflowPipelineRunner 从 Dataflow 文档中运行示例 WordCount 作业时,它会启动工作程序,然后只是挂起状态为 Running。
最后两条状态消息:
Jan 29, 2016, 22:05:50
S02: (b959a12901787f4d): Executing operation ReadLines+WordCount.CountWords/ParDo(ExtractWords)+WordCount.CountWords/Count.PerElement/Init+WordCount.CountWords/Count.PerElement/Count.PerKey/GroupByKey+WordCount.CountWords/Count.PerElement/Count.PerKey/Combine.GroupedValues/Partial+WordCount.CountWords/Count.PerElement/Count.PerKey/GroupByKey/Reify+WordCount.CountWords/Count.PerElement/Count.PerKey/GroupByKey/Write
Jan 29, 2016, 22:06:42
(c3fc1276c0229a41): Workers have started successfully.
Run Code Online (Sandbox Code Playgroud)
就是这样。当我单击“工作日志”时,它完全是空的。保持这种状态至少 20 分钟。
它适用于 DirectPipelineRunner(在几秒钟内完成并在我的 gs://... 上创建输出文件)。
我应该看什么?
命令行参数:
--project=my-project
--stagingLocation=gs://my-project/dataflow/staging
Run Code Online (Sandbox Code Playgroud) 我正在努力从 Python 类的实例中正确打开 TIFF 图像io.BufferedReader。我使用下面的库从 GCS 路径下载图像,但我似乎无法使用传统工具打开图像。
# returns the <_io.BufferedReader>
file = beam.io.gcp.gcsio.GcsIO().open("<GCS_PATH>", 'r')
from PIL import Image
img = Image.open(file.read()) <---- Fails with "TypeError: embedded NUL character"
img = Image.open(file.raw) <--- Fails when any operations are performed with "IOError(err)"
Run Code Online (Sandbox Code Playgroud)
除了 PIL 之外,我对其他库持开放态度。
更新
以下也失败:
img = Image.open(file)
Run Code Online (Sandbox Code Playgroud)
它失败并出现 IOError,指出tempfile.tif: Cannot read TIFF header.
python opencv image python-imaging-library google-cloud-dataflow
我正在尝试使用 python 管道连接到 CloudSQL。
实际情况
连接功能
def cloudSQL(input):
import pymysql
connection = pymysql.connect(host='<server ip>',
user='...',
password='...',
db='...')
cursor = connection.cursor()
cursor.execute("select ...")
connection.close()
result = cursor.fetchone()
if not (result is None):
yield input
Run Code Online (Sandbox Code Playgroud)
错误
这是使用 DataflowRunner 的错误消息
OperationalError: (2003, "Can't connect to MySQL server on '<server ip>' (timed out)")
Run Code Online (Sandbox Code Playgroud)
云SQL
我有 publicIP(使用 directrunner 从本地进行测试),并且我还尝试激活私有 IP 以查看这是否是与 DataflowRunner 连接的问题
选项2
我也尝试过
connection = pymysql.connect((unix_socket='/cloudsql/' + <INSTANCE_CONNECTION_NAME>,
user='...',
password='...',
db='...')
Run Code Online (Sandbox Code Playgroud)
出现错误:
OperationalError: (2003, "Can't connect to …Run Code Online (Sandbox Code Playgroud) python google-cloud-sql google-cloud-platform google-cloud-dataflow
我在运行数据流作业时遇到以下错误。我正在尝试将现有的 Beam 版本更新为 2.11.0,但在运行时出现以下错误。
java.lang.IncompleteClassChangeError:类 org.apache.beam.model.pipeline.v1.RunnerApi$StandardPTransforms$Primitives 未实现 org.apache.beam.runners.core.construction 处请求的接口 com.google.protobuf.ProtocolMessageEnum。 BeamUrns.getUrn(BeamUrns.java:27) 在 org.apache.beam.runners.core.construction.PTransformTranslation.(PTransformTranslation.java:58) 在 org.apache.beam.runners.core.construction.UnconsumedReads$1.visitValue( UnconsumedReads.java:49) 在 org.apache.beam.sdk.runners.TransformHierarchy$Node.visit(TransformHierarchy.java:666) 在 org.apache.beam.sdk.runners.TransformHierarchy$Node.visit(TransformHierarchy.java: 649) 在 org.apache.beam.sdk.runners.TransformHierarchy$Node.visit(TransformHierarchy.java:649) 在 org.apache.beam.sdk.runners.TransformHierarchy$Node.visit(TransformHierarchy.java:649) 在 org .apache.beam.sdk.runners.TransformHierarchy$Node.access$600(TransformHierarchy.java:311) 在 org.apache.beam.sdk.runners.TransformHierarchy.visit(TransformHierarchy.java:245) 在 org.apache.beam。 sdk.Pipeline.traverseTopologically(Pipeline.java:458)在org.apache.beam.runners.core.construction.UnconsumedReads.ensureAllReadsConsumed(UnconsumedReads.java:40)在org.apache.beam.runners.dataflow.DataflowRunner.replaceTransforms( DataflowRunner.java:868) 在 org.apache.beam.runners.dataflow.DataflowRunner.run(DataflowRunner.java:660) 在 org.apache.beam.runners.dataflow.DataflowRunner.run(DataflowRunner.java:173) 在 org .apache.beam.sdk.Pipeline.run(Pipeline.java:313) 在 org.apache.beam.sdk.Pipeline.run(Pipeline.java:299)
我使用 Apache Beam KafkaIO 作为我的管道源。
我需要读取两个 Kafka 主题 topic1 和 topic2,然后将此输入作为一个加入到后续转换中。
问题是 topic1 和 topic2 包含具有不兼容方案的消息,当我阅读时,我会将每个主题的消息映射到相同的方案。
所以我想要的管道看起来像这样:
<read topic1> <read topic2>
| |
<map to Foo> <map to Foo>
| |
\ /
<use same subsequent transforms on Foo>
Run Code Online (Sandbox Code Playgroud)
我发现解决这个问题的一种方法是使用一次订阅多个主题,withTopics(...)然后确定KafkaRecord<K,V>消息来自哪个主题,然后为其执行映射。
这看起来有点笨拙?在 Apache Beam 中有正确的方法吗?
java apache-kafka apache-spark google-cloud-dataflow apache-beam
我正在 Google Cloud Platform(GCP)中运行我的 google dataflow 作业。当我在本地运行此作业时,它运行良好,但是当在 GCP 上运行它时,我收到此错误“java.lang.IllegalArgumentException:找不到方案 gs 的文件系统”。我可以访问该 google cloud URI,我可以将我的 jar 文件上传到该 URI,并且可以看到本地作业的一些临时文件。
我在 GCP 中的职位 ID:
2019-08-08_21_47_27-162804342585245230(光束版本:2.12.0)
2019-08-09_16_41_15-11728697820819900062(光束版本:2.14.0)
我尝试过beam版本2.12.0和2.14.0,它们都有相同的错误。
java.lang.IllegalArgumentException: No filesystem found for scheme gs
at org.apache.beam.sdk.io.FileSystems.getFileSystemInternal(FileSystems.java:456)
at org.apache.beam.sdk.io.FileSystems.matchNewResource(FileSystems.java:526)
at org.apache.beam.sdk.io.gcp.bigquery.BigQueryHelpers.resolveTempLocation(BigQueryHelpers.java:689)
at org.apache.beam.sdk.io.gcp.bigquery.BigQuerySourceBase.extractFiles(BigQuerySourceBase.java:125)
at org.apache.beam.sdk.io.gcp.bigquery.BigQuerySourceBase.split(BigQuerySourceBase.java:148)
at org.apache.beam.runners.dataflow.worker.WorkerCustomSources.splitAndValidate(WorkerCustomSources.java:284)
at org.apache.beam.runners.dataflow.worker.WorkerCustomSources.performSplitTyped(WorkerCustomSources.java:206)
at org.apache.beam.runners.dataflow.worker.WorkerCustomSources.performSplitWithApiLimit(WorkerCustomSources.java:190)
at org.apache.beam.runners.dataflow.worker.WorkerCustomSources.performSplit(WorkerCustomSources.java:169)
at org.apache.beam.runners.dataflow.worker.WorkerCustomSourceOperationExecutor.execute(WorkerCustomSourceOperationExecutor.java:78)
at org.apache.beam.runners.dataflow.worker.BatchDataflowWorker.executeWork(BatchDataflowWorker.java:412)
at org.apache.beam.runners.dataflow.worker.BatchDataflowWorker.doWork(BatchDataflowWorker.java:381)
at org.apache.beam.runners.dataflow.worker.BatchDataflowWorker.getAndPerformWork(BatchDataflowWorker.java:306)
at org.apache.beam.runners.dataflow.worker.DataflowBatchWorkerHarness$WorkerThread.doWork(DataflowBatchWorkerHarness.java:135)
at org.apache.beam.runners.dataflow.worker.DataflowBatchWorkerHarness$WorkerThread.call(DataflowBatchWorkerHarness.java:115)
at org.apache.beam.runners.dataflow.worker.DataflowBatchWorkerHarness$WorkerThread.call(DataflowBatchWorkerHarness.java:102)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Run Code Online (Sandbox Code Playgroud) 我在 Python 上使用 Apache Beam,想问一下Wait.on()Python SDK 上的 Apache Beam Java 相当于什么?
目前我对下面的代码片段有问题
if len(output_pcoll) > 1:
merged = (tuple(output_pcoll) |
'MergePCollections1' >> beam.Flatten())
else:
merged = output_pcoll[0]
outlier_side_input = self.construct_outlier_side_input(merged)
(merged |
"RemoveOutlier" >>
beam.ParDo(utils.Remove_Outliers(),
beam.pvalue.AsDict(outlier_side_input)) |
"WriteToCSV" >>
beam.io.WriteToText('../../ML-DATA/{0}.{1}'.format(self.BUCKET,
self.OUTPUT), num_shards=1))
Run Code Online (Sandbox Code Playgroud)
看来 Apache Beam 不会等到代码self.construct_outlier_side_input执行完成,并在下一个管道中执行“RemoveOutlier”时导致空侧输入。在Java版本中你可以使用Wait.On()等待construct_outlier_side_input完成执行,但是我在Python SDK中找不到等效的方法。
--编辑--我想要实现的目标几乎与此链接中的相同, https://rmannibucau.metawerx.net/post/apache-beam-initialization-destruction-task
我需要使用 Azure 数据流表达式生成器生成 SQL 字符串,但它不允许我使用 Concat 函数在字符串之间添加单引号
我需要一个如下的 SQL 字符串
SELECT * FROM ABC WHERE myDate <= '2019-10-10'
Run Code Online (Sandbox Code Playgroud)
这里 2019-10-10 来自参数,所以我构建的表达式如下
concat('SELECT * FROM ABC WHERE myDate >=','''',$ToDate,'''')
Run Code Online (Sandbox Code Playgroud)
但上面的语句无法解析表达式。
结果将作为 SQL 查询执行。SQL 查询不允许使用双引号。它必须是单引号。
使用数据工厂表达式可以轻松实现这一点,但使用天蓝色数据流表达式则无法实现。
sql expression quote google-cloud-dataflow azure-data-factory
我刚刚开始在 Google Cloud Dataflow 上使用 Apache Beam。我有一个使用计费帐户设置的项目。我计划使用该项目的唯一目的是: 1. 数据流 - 用于所有数据处理 2. pubsub - 用于导出 Stackdriver 日志以供 Datadog 使用
现在,当我写这篇文章时,我当前没有运行任何数据流作业。
回顾过去一个月,我发现数据流成本约为 15 美元,Stackdriver Monitor API 成本约为 18 美元。看起来 Stackdriver Monitor API 的固定价格接近 1.46 美元/天。
我很好奇如何减轻这种情况。我不认为我想要或不需要 Stackdriver Monitoring。是强制性的吗?此外,虽然我觉得我没有运行任何东西,但在过去的一个小时里我看到了这一点:
所以我想问题是这些: 1. 这些调用是什么?2. 是否可以禁用数据流的 Stackdriver 监控或以其他方式降低成本?
google-cloud-platform google-cloud-dataflow stackdriver google-cloud-stackdriver
apache-beam ×4
python ×3
apache-kafka ×1
apache-spark ×1
expression ×1
go ×1
image ×1
java ×1
opencv ×1
quote ×1
sql ×1
stackdriver ×1