[
https://issues.apache.org/jira/browse/BEAM-4066?focusedWorklogId=94622&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-94622
]
ASF GitHub Bot logged work on BEAM-4066:
----------------------------------------
Author: ASF GitHub Bot
Created on: 24/Apr/18 14:59
Start Date: 24/Apr/18 14:59
Worklog Time Spent: 10m
Work Description: iemejia closed pull request #5202: [BEAM-4066] Fix
Nexmark fails when running with PubSub
URL: https://github.com/apache/beam/pull/5202
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git
a/sdks/java/nexmark/src/main/java/org/apache/beam/sdk/nexmark/NexmarkLauncher.java
b/sdks/java/nexmark/src/main/java/org/apache/beam/sdk/nexmark/NexmarkLauncher.java
index cd24897664a..8f0213669cd 100644
---
a/sdks/java/nexmark/src/main/java/org/apache/beam/sdk/nexmark/NexmarkLauncher.java
+++
b/sdks/java/nexmark/src/main/java/org/apache/beam/sdk/nexmark/NexmarkLauncher.java
@@ -755,20 +755,8 @@ private String logsDir(long now) {
io = io.withTimestampAttribute(NexmarkUtils.PUBSUB_TIMESTAMP);
}
- return p
- .apply(queryName + ".ReadPubsubEvents", io)
- .apply(queryName + ".PubsubMessageToEvent", ParDo.of(new
DoFn<PubsubMessage, Event>() {
- @ProcessElement
- public void processElement(ProcessContext c) {
- byte[] payload = c.element().getPayload();
- try {
- Event event = CoderUtils.decodeFromByteArray(Event.CODER, payload);
- c.output(event);
- } catch (CoderException e) {
- LOG.error("Error while decoding Event from pusbSub message:
serialization error");
- }
- }
- }));
+ return p.apply(queryName + ".ReadPubsubEvents", io)
+ .apply(queryName + ".PubsubMessageToEvent", ParDo.of(new
PubsubMessageEventDoFn()));
}
static final DoFn<Event, byte[]> EVENT_TO_BYTEARRAY =
@@ -864,22 +852,7 @@ private void sinkEventsToPubsub(PCollection<Event> events,
long now) {
}
events
- .apply(
- queryName + ".EventToPubsubMessage",
- ParDo.of(
- new DoFn<Event, PubsubMessage>() {
- @ProcessElement
- public void processElement(ProcessContext c) {
- try {
- byte[] payload =
CoderUtils.encodeToByteArray(Event.CODER, c.element());
- c.output(new PubsubMessage(payload, new HashMap<>()));
- } catch (CoderException e1) {
- LOG.error(
- "Error while sending Event {} to pusbSub:
serialization error",
- c.element().toString());
- }
- }
- }))
+ .apply(queryName + ".EventToPubsubMessage", ParDo.of(new
EventPubsubMessageDoFn()))
.apply(queryName + ".WritePubsubEvents", io);
}
@@ -1323,4 +1296,32 @@ private NexmarkQuery getNexmarkQuery() {
new Query11(configuration),
new Query12(configuration));
}
+
+ private static class PubsubMessageEventDoFn extends DoFn<PubsubMessage,
Event> {
+
+ @ProcessElement
+ public void processElement(ProcessContext c) {
+ byte[] payload = c.element().getPayload();
+ try {
+ Event event = CoderUtils.decodeFromByteArray(Event.CODER, payload);
+ c.output(event);
+ } catch (CoderException e) {
+ LOG.error("Error while decoding Event from pusbSub message:
serialization error");
+ }
+ }
+ }
+
+ private static class EventPubsubMessageDoFn extends DoFn<Event,
PubsubMessage> {
+
+ @ProcessElement
+ public void processElement(ProcessContext c) {
+ try {
+ byte[] payload = CoderUtils.encodeToByteArray(Event.CODER,
c.element());
+ c.output(new PubsubMessage(payload, new HashMap<>()));
+ } catch (CoderException e1) {
+ LOG.error(
+ "Error while sending Event {} to pusbSub: serialization error",
c.element().toString());
+ }
+ }
+ }
}
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 94622)
Time Spent: 0.5h (was: 20m)
> Nexmark fails when running with PubSub as source/sink
> -----------------------------------------------------
>
> Key: BEAM-4066
> URL: https://issues.apache.org/jira/browse/BEAM-4066
> Project: Beam
> Issue Type: Bug
> Components: examples-nexmark
> Reporter: Alexey Romanenko
> Assignee: Alexey Romanenko
> Priority: Minor
> Fix For: 2.5.0
>
> Attachments: gistfile1.txt
>
> Time Spent: 0.5h
> Remaining Estimate: 0h
>
> Running Nexmark with PubSub cause this exception:
> {noformat}
> Caused by: java.io.NotSerializableException:
> org.apache.beam.sdk.nexmark.NexmarkLauncher
> {noformat}
> Full log is attached.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)