{"action":"created","comment":{"url":"https://api.github.com/repos/apache/beam/pulls/comments/233194809","pull_request_review_id":174551709,"id":233194809,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzMzE5NDgwOQ==","diff_hunk":"@@ -359,13 +533,100 @@ public void finishBundle() {\n         emitResults();\n       } catch (Exception e) {\n         throw new RuntimeException(\"Failed to finish remote bundle\", e);\n+      } finally {\n+        remoteBundle = null;\n+      }\n+      if (bundleFinishedCallback != null) {\n+        bundleFinishedCallback.run();\n+        bundleFinishedCallback = null;\n       }\n     }\n \n+    /** Key for timer which has not been registered yet. */\n+    Object getTimerKeyForRegistration() {\n+      return keyForTimerToBeSet;\n+    }\n+\n+    /** Key for timer which is about to be fired. */\n+    void setTimerKeyForFire(Object key) {\n+      this.keyForTimerToBeFired = key;\n+    }\n+\n+    boolean isBundleInProgress() {\n+      return remoteBundle != null;\n+    }\n+\n+    void setBundleFinishedCallback(Runnable callback) {\n+      this.bundleFinishedCallback = callback;\n+    }\n+\n     private void emitResults() {\n       KV<String, OutputT> result;\n       while ((result = outputQueue.poll()) != null) {\n-        outputManager.output(outputMap.get(result.getKey()), (WindowedValue) result.getValue());\n+        final String outputPCollectionId = Preconditions.checkNotNull(result.getKey());\n+        TupleTag<?> tag = outputMap.get(outputPCollectionId);\n+        WindowedValue windowedValue =\n+            Preconditions.checkNotNull(\n+                (WindowedValue) result.getValue(),\n+                \"Received a null value from the SDK harness for %s\",\n+                outputPCollectionId);\n+        if (tag != null) {\n+          // process regular elements\n+          outputManager.output(tag, windowedValue);\n+        } else {\n+          final String timerCollectionId = extractTimerPCollectionId(outputPCollectionId);\n+          TimerSpec timerSpec = extractTimerSpec(timerCollectionId);\n+          Timer timer =\n+              Preconditions.checkNotNull(\n+                  (Timer) ((KV) windowedValue.getValue()).getValue(),\n+                  \"Received null Timer from SDK harness: %s\",\n+                  windowedValue);\n+          LOG.debug(\"Timer received: {} {}\", outputPCollectionId, timer);\n+          for (Object window : windowedValue.getWindows()) {\n+            StateNamespace namespace = StateNamespaces.window(windowCoder, (BoundedWindow) window);\n+            TimerInternals.TimerData timerData =\n+                TimerInternals.TimerData.of(\n+                    timerCollectionId, namespace, timer.getTimestamp(), timerSpec.getTimeDomain());\n+            setTimer(windowedValue, timerData);\n+          }\n+        }\n+      }\n+    }\n+\n+    private String extractTimerPCollectionId(String outputPCollectionId) {\n+      return stageBundleFactory\n+          .getProcessBundleDescriptor()\n+          .getProcessBundleDescriptor()\n+          .getPcollectionsMap()\n+          .get(outputPCollectionId)\n+          .getUniqueName();","path":"runners/flink/src/main/java/org/apache/beam/runners/flink/translation/wrappers/streaming/ExecutableStageDoFnOperator.java","position":424,"original_position":424,"commit_id":"49ea0b96825ccd8e461bfa94946ae7c21799ed6b","original_commit_id":"49ea0b96825ccd8e461bfa94946ae7c21799ed6b","user":{"login":"mxm","id":837221,"node_id":"MDQ6VXNlcjgzNzIyMQ==","avatar_url":"https://avatars1.githubusercontent.com/u/837221?v=4","gravatar_id":"","url":"https://api.github.com/users/mxm","html_url":"https://github.com/mxm","followers_url":"https://api.github.com/users/mxm/followers","following_url":"https://api.github.com/users/mxm/following{/other_user}","gists_url":"https://api.github.com/users/mxm/gists{/gist_id}","starred_url":"https://api.github.com/users/mxm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mxm/subscriptions","organizations_url":"https://api.github.com/users/mxm/orgs","repos_url":"https://api.github.com/users/mxm/repos","events_url":"https://api.github.com/users/mxm/events{/privacy}","received_events_url":"https://api.github.com/users/mxm/received_events","type":"User","site_admin":false},"body":"The name here is somehow not stable anymore after #6986.","created_at":"2018-11-13T19:41:05Z","updated_at":"2018-11-13T19:41:05Z","html_url":"https://github.com/apache/beam/pull/6981#discussion_r233194809","pull_request_url":"https://api.github.com/repos/apache/beam/pulls/6981","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/apache/beam/pulls/comments/233194809"},"html":{"href":"https://github.com/apache/beam/pull/6981#discussion_r233194809"},"pull_request":{"href":"https://api.github.com/repos/apache/beam/pulls/6981"}}},"pull_request":{"url":"https://api.github.com/repos/apache/beam/pulls/6981","id":229142874,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI5MTQyODc0","html_url":"https://github.com/apache/beam/pull/6981","diff_url":"https://github.com/apache/beam/pull/6981.diff","patch_url":"https://github.com/apache/beam/pull/6981.patch","issue_url":"https://api.github.com/repos/apache/beam/issues/6981","number":6981,"state":"open","locked":false,"title":"[BEAM-4681] Add support for portable timers in Flink streaming mode ","user":{"login":"mxm","id":837221,"node_id":"MDQ6VXNlcjgzNzIyMQ==","avatar_url":"https://avatars1.githubusercontent.com/u/837221?v=4","gravatar_id":"","url":"https://api.github.com/users/mxm","html_url":"https://github.com/mxm","followers_url":"https://api.github.com/users/mxm/followers","following_url":"https://api.github.com/users/mxm/following{/other_user}","gists_url":"https://api.github.com/users/mxm/gists{/gist_id}","starred_url":"https://api.github.com/users/mxm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mxm/subscriptions","organizations_url":"https://api.github.com/users/mxm/orgs","repos_url":"https://api.github.com/users/mxm/repos","events_url":"https://api.github.com/users/mxm/events{/privacy}","received_events_url":"https://api.github.com/users/mxm/received_events","type":"User","site_admin":false},"body":"This adds support for portable timers to the Flink Runner in streaming mode. Batch support will be added in a follow-up.\r\n\r\nThe `UsesTimersInParDo` tests of Java ValidatesPortableRunner have been run on it and they are passing. We can't enable them yet because they currently run only for batch. See https://issues.apache.org/jira/browse/BEAM-6009.\r\n\r\nTo enable the Python ValidatesPortableRunner tests https://issues.apache.org/jira/browse/BEAM-5999 needs to be addressed.\r\n\r\nCC @tweise @angoenka @robertwb \r\n\r\nPost-Commit Tests Status (on master branch)\r\n------------------------------------------------------------------------------------------------\r\n\r\nLang | SDK | Apex | Dataflow | Flink | Gearpump | Samza | Spark\r\n--- | --- | --- | --- | --- | --- | --- | ---\r\nGo | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Go_GradleBuild/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Go_GradleBuild/lastCompletedBuild/) | --- | --- | --- | --- | --- | ---\r\nJava | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Java_GradleBuild/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_GradleBuild/lastCompletedBuild/) | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Apex_Gradle/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Apex_Gradle/lastCompletedBuild/) | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Dataflow_Gradle/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Dataflow_Gradle/lastCompletedBuild/) | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Flink_Gradle/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Flink_Gradle/lastCompletedBuild/) [![Build Status](https://builds.apache.org/job/beam_PostCommit_Java_PVR_Flink/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_PVR_Flink/lastCompletedBuild/) | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Gearpump_Gradle/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Gearpump_Gradle/lastCompletedBuild/) | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Samza_Gradle/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Samza_Gradle/lastCompletedBuild/) | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Spark_Gradle/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Spark_Gradle/lastCompletedBuild/)\r\nPython | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Python_Verify/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Python_Verify/lastCompletedBuild/) | --- | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Py_VR_Dataflow/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Py_VR_Dataflow/lastCompletedBuild/) </br> [![Build Status](https://builds.apache.org/job/beam_PostCommit_Py_ValCont/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Py_ValCont/lastCompletedBuild/) | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Python_VR_Flink/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Python_VR_Flink/lastCompletedBuild/) | --- | --- | ---\r\n\r\n\r\n\r\n\r\n","created_at":"2018-11-07T19:30:41Z","updated_at":"2018-11-13T19:41:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"56e7abcb432b18264c33532a847a1ca846be0d5f","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/apache/beam/pulls/6981/commits","review_comments_url":"https://api.github.com/repos/apache/beam/pulls/6981/comments","review_comment_url":"https://api.github.com/repos/apache/beam/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/beam/issues/6981/comments","statuses_url":"https://api.github.com/repos/apache/beam/statuses/49ea0b96825ccd8e461bfa94946ae7c21799ed6b","head":{"label":"mxm:flink-timers","ref":"flink-timers","sha":"49ea0b96825ccd8e461bfa94946ae7c21799ed6b","user":{"login":"mxm","id":837221,"node_id":"MDQ6VXNlcjgzNzIyMQ==","avatar_url":"https://avatars1.githubusercontent.com/u/837221?v=4","gravatar_id":"","url":"https://api.github.com/users/mxm","html_url":"https://github.com/mxm","followers_url":"https://api.github.com/users/mxm/followers","following_url":"https://api.github.com/users/mxm/following{/other_user}","gists_url":"https://api.github.com/users/mxm/gists{/gist_id}","starred_url":"https://api.github.com/users/mxm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mxm/subscriptions","organizations_url":"https://api.github.com/users/mxm/orgs","repos_url":"https://api.github.com/users/mxm/repos","events_url":"https://api.github.com/users/mxm/events{/privacy}","received_events_url":"https://api.github.com/users/mxm/received_events","type":"User","site_admin":false},"repo":{"id":52998913,"node_id":"MDEwOlJlcG9zaXRvcnk1Mjk5ODkxMw==","name":"beam","full_name":"mxm/beam","private":false,"owner":{"login":"mxm","id":837221,"node_id":"MDQ6VXNlcjgzNzIyMQ==","avatar_url":"https://avatars1.githubusercontent.com/u/837221?v=4","gravatar_id":"","url":"https://api.github.com/users/mxm","html_url":"https://github.com/mxm","followers_url":"https://api.github.com/users/mxm/followers","following_url":"https://api.github.com/users/mxm/following{/other_user}","gists_url":"https://api.github.com/users/mxm/gists{/gist_id}","starred_url":"https://api.github.com/users/mxm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mxm/subscriptions","organizations_url":"https://api.github.com/users/mxm/orgs","repos_url":"https://api.github.com/users/mxm/repos","events_url":"https://api.github.com/users/mxm/events{/privacy}","received_events_url":"https://api.github.com/users/mxm/received_events","type":"User","site_admin":false},"html_url":"https://github.com/mxm/beam","description":"Mirror of Apache Beam","fork":true,"url":"https://api.github.com/repos/mxm/beam","forks_url":"https://api.github.com/repos/mxm/beam/forks","keys_url":"https://api.github.com/repos/mxm/beam/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mxm/beam/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mxm/beam/teams","hooks_url":"https://api.github.com/repos/mxm/beam/hooks","issue_events_url":"https://api.github.com/repos/mxm/beam/issues/events{/number}","events_url":"https://api.github.com/repos/mxm/beam/events","assignees_url":"https://api.github.com/repos/mxm/beam/assignees{/user}","branches_url":"https://api.github.com/repos/mxm/beam/branches{/branch}","tags_url":"https://api.github.com/repos/mxm/beam/tags","blobs_url":"https://api.github.com/repos/mxm/beam/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mxm/beam/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mxm/beam/git/refs{/sha}","trees_url":"https://api.github.com/repos/mxm/beam/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mxm/beam/statuses/{sha}","languages_url":"https://api.github.com/repos/mxm/beam/languages","stargazers_url":"https://api.github.com/repos/mxm/beam/stargazers","contributors_url":"https://api.github.com/repos/mxm/beam/contributors","subscribers_url":"https://api.github.com/repos/mxm/beam/subscribers","subscription_url":"https://api.github.com/repos/mxm/beam/subscription","commits_url":"https://api.github.com/repos/mxm/beam/commits{/sha}","git_commits_url":"https://api.github.com/repos/mxm/beam/git/commits{/sha}","comments_url":"https://api.github.com/repos/mxm/beam/comments{/number}","issue_comment_url":"https://api.github.com/repos/mxm/beam/issues/comments{/number}","contents_url":"https://api.github.com/repos/mxm/beam/contents/{+path}","compare_url":"https://api.github.com/repos/mxm/beam/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mxm/beam/merges","archive_url":"https://api.github.com/repos/mxm/beam/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mxm/beam/downloads","issues_url":"https://api.github.com/repos/mxm/beam/issues{/number}","pulls_url":"https://api.github.com/repos/mxm/beam/pulls{/number}","milestones_url":"https://api.github.com/repos/mxm/beam/milestones{/number}","notifications_url":"https://api.github.com/repos/mxm/beam/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mxm/beam/labels{/name}","releases_url":"https://api.github.com/repos/mxm/beam/releases{/id}","deployments_url":"https://api.github.com/repos/mxm/beam/deployments","created_at":"2016-03-02T21:48:54Z","updated_at":"2018-08-15T10:11:24Z","pushed_at":"2018-11-13T17:34:14Z","git_url":"git://github.com/mxm/beam.git","ssh_url":"git@github.com:mxm/beam.git","clone_url":"https://github.com/mxm/beam.git","svn_url":"https://github.com/mxm/beam","homepage":"","size":108581,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"623e2f63832b3a650feff643d307e3a96291e664","user":{"login":"apache","id":47359,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ3MzU5","avatar_url":"https://avatars0.githubusercontent.com/u/47359?v=4","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":50904245,"node_id":"MDEwOlJlcG9zaXRvcnk1MDkwNDI0NQ==","name":"beam","full_name":"apache/beam","private":false,"owner":{"login":"apache","id":47359,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ3MzU5","avatar_url":"https://avatars0.githubusercontent.com/u/47359?v=4","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/apache/beam","description":"Apache Beam","fork":false,"url":"https://api.github.com/repos/apache/beam","forks_url":"https://api.github.com/repos/apache/beam/forks","keys_url":"https://api.github.com/repos/apache/beam/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/beam/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/beam/teams","hooks_url":"https://api.github.com/repos/apache/beam/hooks","issue_events_url":"https://api.github.com/repos/apache/beam/issues/events{/number}","events_url":"https://api.github.com/repos/apache/beam/events","assignees_url":"https://api.github.com/repos/apache/beam/assignees{/user}","branches_url":"https://api.github.com/repos/apache/beam/branches{/branch}","tags_url":"https://api.github.com/repos/apache/beam/tags","blobs_url":"https://api.github.com/repos/apache/beam/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/beam/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/beam/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/beam/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/beam/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/beam/languages","stargazers_url":"https://api.github.com/repos/apache/beam/stargazers","contributors_url":"https://api.github.com/repos/apache/beam/contributors","subscribers_url":"https://api.github.com/repos/apache/beam/subscribers","subscription_url":"https://api.github.com/repos/apache/beam/subscription","commits_url":"https://api.github.com/repos/apache/beam/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/beam/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/beam/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/beam/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/beam/contents/{+path}","compare_url":"https://api.github.com/repos/apache/beam/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/beam/merges","archive_url":"https://api.github.com/repos/apache/beam/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/beam/downloads","issues_url":"https://api.github.com/repos/apache/beam/issues{/number}","pulls_url":"https://api.github.com/repos/apache/beam/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/beam/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/beam/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/beam/labels{/name}","releases_url":"https://api.github.com/repos/apache/beam/releases{/id}","deployments_url":"https://api.github.com/repos/apache/beam/deployments","created_at":"2016-02-02T08:00:06Z","updated_at":"2018-11-13T18:55:51Z","pushed_at":"2018-11-13T19:25:29Z","git_url":"git://github.com/apache/beam.git","ssh_url":"git@github.com:apache/beam.git","clone_url":"https://github.com/apache/beam.git","svn_url":"https://github.com/apache/beam","homepage":"https://beam.apache.org","size":111281,"stargazers_count":2316,"watchers_count":2316,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1440,"mirror_url":null,"archived":false,"open_issues_count":78,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":1440,"open_issues":78,"watchers":2316,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/beam/pulls/6981"},"html":{"href":"https://github.com/apache/beam/pull/6981"},"issue":{"href":"https://api.github.com/repos/apache/beam/issues/6981"},"comments":{"href":"https://api.github.com/repos/apache/beam/issues/6981/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/beam/pulls/6981/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/beam/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/beam/pulls/6981/commits"},"statuses":{"href":"https://api.github.com/repos/apache/beam/statuses/49ea0b96825ccd8e461bfa94946ae7c21799ed6b"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"mxm"}}