{"action":"created","comment":{"url":"https://api.github.com/repos/apache/incubator-beam/pulls/comments/76399571","id":76399571,"diff_hunk":"@@ -138,14 +136,22 @@ private SparkRunner(SparkPipelineOptions options) {\n     mOptions = options;\n   }\n \n-\n   @Override\n   public EvaluationResult run(Pipeline pipeline) {\n     try {\n       LOG.info(\"Executing pipeline using the SparkRunner.\");\n-      JavaSparkContext jsc = SparkContextFactory.getSparkContext(mOptions.getSparkMaster(),\n-          mOptions.getAppName());\n-\n+      JavaSparkContext jsc = mOptions.getProvidedSparkContext();\n+      if (mOptions.getUsesProvidedSparkContext() && jsc != null) {\n+        LOG.info(\"Using a provided Spark Context\");\n+        if (jsc.sc().isStopped()){\n+          LOG.error(\"The provided Spark context \"\n+                  + jsc + \" is stopped\");\n+          throw new RuntimeException(\"The provided Spark context is stopped\");\n+        }\n+      } else {\n+        LOG.info(\"Creating a new Spark Java Context\");","path":"runners/spark/src/main/java/org/apache/beam/runners/spark/SparkRunner.java","position":37,"original_position":37,"commit_id":"2eabfaa31fc0346b9dfab35f6f8d27fb638c0238","original_commit_id":"2eabfaa31fc0346b9dfab35f6f8d27fb638c0238","user":{"login":"amitsela","id":4245753,"avatar_url":"https://avatars.githubusercontent.com/u/4245753?v=3","gravatar_id":"","url":"https://api.github.com/users/amitsela","html_url":"https://github.com/amitsela","followers_url":"https://api.github.com/users/amitsela/followers","following_url":"https://api.github.com/users/amitsela/following{/other_user}","gists_url":"https://api.github.com/users/amitsela/gists{/gist_id}","starred_url":"https://api.github.com/users/amitsela/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amitsela/subscriptions","organizations_url":"https://api.github.com/users/amitsela/orgs","repos_url":"https://api.github.com/users/amitsela/repos","events_url":"https://api.github.com/users/amitsela/events{/privacy}","received_events_url":"https://api.github.com/users/amitsela/received_events","type":"User","site_admin":false},"body":"Java/Scala implementation is not relevant in runtime.","created_at":"2016-08-26T10:43:47Z","updated_at":"2016-08-26T10:43:47Z","html_url":"https://github.com/apache/incubator-beam/pull/401#discussion_r76399571","pull_request_url":"https://api.github.com/repos/apache/incubator-beam/pulls/401","_links":{"self":{"href":"https://api.github.com/repos/apache/incubator-beam/pulls/comments/76399571"},"html":{"href":"https://github.com/apache/incubator-beam/pull/401#discussion_r76399571"},"pull_request":{"href":"https://api.github.com/repos/apache/incubator-beam/pulls/401"}}},"pull_request":{"url":"https://api.github.com/repos/apache/incubator-beam/pulls/401","id":72017666,"html_url":"https://github.com/apache/incubator-beam/pull/401","diff_url":"https://github.com/apache/incubator-beam/pull/401.diff","patch_url":"https://github.com/apache/incubator-beam/pull/401.patch","issue_url":"https://api.github.com/repos/apache/incubator-beam/issues/401","number":401,"state":"open","locked":false,"title":"[BEAM-313] Enable the use of an existing spark context with the SparkPipelineRunner","user":{"login":"amarouni","id":10761082,"avatar_url":"https://avatars.githubusercontent.com/u/10761082?v=3","gravatar_id":"","url":"https://api.github.com/users/amarouni","html_url":"https://github.com/amarouni","followers_url":"https://api.github.com/users/amarouni/followers","following_url":"https://api.github.com/users/amarouni/following{/other_user}","gists_url":"https://api.github.com/users/amarouni/gists{/gist_id}","starred_url":"https://api.github.com/users/amarouni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amarouni/subscriptions","organizations_url":"https://api.github.com/users/amarouni/orgs","repos_url":"https://api.github.com/users/amarouni/repos","events_url":"https://api.github.com/users/amarouni/events{/privacy}","received_events_url":"https://api.github.com/users/amarouni/received_events","type":"User","site_admin":false},"body":"The general use case is that the SparkPipelineRunner creates its own Spark context and uses it for the pipeline execution.\r\nAnother alternative is to provide the SparkPipelineRunner with an existing spark context. This can be interesting for a lot of use cases where the Spark context is managed outside of beam (context reuse, advanced context management, spark job server, ...).","created_at":"2016-05-31T13:43:11Z","updated_at":"2016-08-26T10:43:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"75d8d9f88a6ef5a13ae79cb127390ef432970cbb","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/apache/incubator-beam/pulls/401/commits","review_comments_url":"https://api.github.com/repos/apache/incubator-beam/pulls/401/comments","review_comment_url":"https://api.github.com/repos/apache/incubator-beam/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/incubator-beam/issues/401/comments","statuses_url":"https://api.github.com/repos/apache/incubator-beam/statuses/2eabfaa31fc0346b9dfab35f6f8d27fb638c0238","head":{"label":"amarouni:mycbeam313","ref":"mycbeam313","sha":"2eabfaa31fc0346b9dfab35f6f8d27fb638c0238","user":{"login":"amarouni","id":10761082,"avatar_url":"https://avatars.githubusercontent.com/u/10761082?v=3","gravatar_id":"","url":"https://api.github.com/users/amarouni","html_url":"https://github.com/amarouni","followers_url":"https://api.github.com/users/amarouni/followers","following_url":"https://api.github.com/users/amarouni/following{/other_user}","gists_url":"https://api.github.com/users/amarouni/gists{/gist_id}","starred_url":"https://api.github.com/users/amarouni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amarouni/subscriptions","organizations_url":"https://api.github.com/users/amarouni/orgs","repos_url":"https://api.github.com/users/amarouni/repos","events_url":"https://api.github.com/users/amarouni/events{/privacy}","received_events_url":"https://api.github.com/users/amarouni/received_events","type":"User","site_admin":false},"repo":{"id":59840169,"name":"incubator-beam","full_name":"amarouni/incubator-beam","owner":{"login":"amarouni","id":10761082,"avatar_url":"https://avatars.githubusercontent.com/u/10761082?v=3","gravatar_id":"","url":"https://api.github.com/users/amarouni","html_url":"https://github.com/amarouni","followers_url":"https://api.github.com/users/amarouni/followers","following_url":"https://api.github.com/users/amarouni/following{/other_user}","gists_url":"https://api.github.com/users/amarouni/gists{/gist_id}","starred_url":"https://api.github.com/users/amarouni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amarouni/subscriptions","organizations_url":"https://api.github.com/users/amarouni/orgs","repos_url":"https://api.github.com/users/amarouni/repos","events_url":"https://api.github.com/users/amarouni/events{/privacy}","received_events_url":"https://api.github.com/users/amarouni/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/amarouni/incubator-beam","description":"Mirror of Apache Beam (Incubating)","fork":true,"url":"https://api.github.com/repos/amarouni/incubator-beam","forks_url":"https://api.github.com/repos/amarouni/incubator-beam/forks","keys_url":"https://api.github.com/repos/amarouni/incubator-beam/keys{/key_id}","collaborators_url":"https://api.github.com/repos/amarouni/incubator-beam/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/amarouni/incubator-beam/teams","hooks_url":"https://api.github.com/repos/amarouni/incubator-beam/hooks","issue_events_url":"https://api.github.com/repos/amarouni/incubator-beam/issues/events{/number}","events_url":"https://api.github.com/repos/amarouni/incubator-beam/events","assignees_url":"https://api.github.com/repos/amarouni/incubator-beam/assignees{/user}","branches_url":"https://api.github.com/repos/amarouni/incubator-beam/branches{/branch}","tags_url":"https://api.github.com/repos/amarouni/incubator-beam/tags","blobs_url":"https://api.github.com/repos/amarouni/incubator-beam/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/amarouni/incubator-beam/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/amarouni/incubator-beam/git/refs{/sha}","trees_url":"https://api.github.com/repos/amarouni/incubator-beam/git/trees{/sha}","statuses_url":"https://api.github.com/repos/amarouni/incubator-beam/statuses/{sha}","languages_url":"https://api.github.com/repos/amarouni/incubator-beam/languages","stargazers_url":"https://api.github.com/repos/amarouni/incubator-beam/stargazers","contributors_url":"https://api.github.com/repos/amarouni/incubator-beam/contributors","subscribers_url":"https://api.github.com/repos/amarouni/incubator-beam/subscribers","subscription_url":"https://api.github.com/repos/amarouni/incubator-beam/subscription","commits_url":"https://api.github.com/repos/amarouni/incubator-beam/commits{/sha}","git_commits_url":"https://api.github.com/repos/amarouni/incubator-beam/git/commits{/sha}","comments_url":"https://api.github.com/repos/amarouni/incubator-beam/comments{/number}","issue_comment_url":"https://api.github.com/repos/amarouni/incubator-beam/issues/comments{/number}","contents_url":"https://api.github.com/repos/amarouni/incubator-beam/contents/{+path}","compare_url":"https://api.github.com/repos/amarouni/incubator-beam/compare/{base}...{head}","merges_url":"https://api.github.com/repos/amarouni/incubator-beam/merges","archive_url":"https://api.github.com/repos/amarouni/incubator-beam/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/amarouni/incubator-beam/downloads","issues_url":"https://api.github.com/repos/amarouni/incubator-beam/issues{/number}","pulls_url":"https://api.github.com/repos/amarouni/incubator-beam/pulls{/number}","milestones_url":"https://api.github.com/repos/amarouni/incubator-beam/milestones{/number}","notifications_url":"https://api.github.com/repos/amarouni/incubator-beam/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/amarouni/incubator-beam/labels{/name}","releases_url":"https://api.github.com/repos/amarouni/incubator-beam/releases{/id}","deployments_url":"https://api.github.com/repos/amarouni/incubator-beam/deployments","created_at":"2016-05-27T14:26:03Z","updated_at":"2016-05-27T14:26:07Z","pushed_at":"2016-08-25T16:05:15Z","git_url":"git://github.com/amarouni/incubator-beam.git","ssh_url":"git@github.com:amarouni/incubator-beam.git","clone_url":"https://github.com/amarouni/incubator-beam.git","svn_url":"https://github.com/amarouni/incubator-beam","homepage":null,"size":17227,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"f7384e1a6fb592500495bef8f4498f56287aa159","user":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","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,"name":"incubator-beam","full_name":"apache/incubator-beam","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","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},"private":false,"html_url":"https://github.com/apache/incubator-beam","description":"Mirror of Apache Beam (Incubating)","fork":false,"url":"https://api.github.com/repos/apache/incubator-beam","forks_url":"https://api.github.com/repos/apache/incubator-beam/forks","keys_url":"https://api.github.com/repos/apache/incubator-beam/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/incubator-beam/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/incubator-beam/teams","hooks_url":"https://api.github.com/repos/apache/incubator-beam/hooks","issue_events_url":"https://api.github.com/repos/apache/incubator-beam/issues/events{/number}","events_url":"https://api.github.com/repos/apache/incubator-beam/events","assignees_url":"https://api.github.com/repos/apache/incubator-beam/assignees{/user}","branches_url":"https://api.github.com/repos/apache/incubator-beam/branches{/branch}","tags_url":"https://api.github.com/repos/apache/incubator-beam/tags","blobs_url":"https://api.github.com/repos/apache/incubator-beam/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/incubator-beam/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/incubator-beam/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/incubator-beam/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/incubator-beam/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/incubator-beam/languages","stargazers_url":"https://api.github.com/repos/apache/incubator-beam/stargazers","contributors_url":"https://api.github.com/repos/apache/incubator-beam/contributors","subscribers_url":"https://api.github.com/repos/apache/incubator-beam/subscribers","subscription_url":"https://api.github.com/repos/apache/incubator-beam/subscription","commits_url":"https://api.github.com/repos/apache/incubator-beam/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/incubator-beam/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/incubator-beam/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/incubator-beam/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/incubator-beam/contents/{+path}","compare_url":"https://api.github.com/repos/apache/incubator-beam/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/incubator-beam/merges","archive_url":"https://api.github.com/repos/apache/incubator-beam/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/incubator-beam/downloads","issues_url":"https://api.github.com/repos/apache/incubator-beam/issues{/number}","pulls_url":"https://api.github.com/repos/apache/incubator-beam/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/incubator-beam/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/incubator-beam/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/incubator-beam/labels{/name}","releases_url":"https://api.github.com/repos/apache/incubator-beam/releases{/id}","deployments_url":"https://api.github.com/repos/apache/incubator-beam/deployments","created_at":"2016-02-02T08:00:06Z","updated_at":"2016-08-26T07:58:58Z","pushed_at":"2016-08-26T10:12:45Z","git_url":"git://github.com/apache/incubator-beam.git","ssh_url":"git@github.com:apache/incubator-beam.git","clone_url":"https://github.com/apache/incubator-beam.git","svn_url":"https://github.com/apache/incubator-beam","homepage":null,"size":27272,"stargazers_count":320,"watchers_count":320,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":198,"mirror_url":"git://git.apache.org/incubator-beam.git","open_issues_count":47,"forks":198,"open_issues":47,"watchers":320,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/incubator-beam/pulls/401"},"html":{"href":"https://github.com/apache/incubator-beam/pull/401"},"issue":{"href":"https://api.github.com/repos/apache/incubator-beam/issues/401"},"comments":{"href":"https://api.github.com/repos/apache/incubator-beam/issues/401/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/incubator-beam/pulls/401/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/incubator-beam/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/incubator-beam/pulls/401/commits"},"statuses":{"href":"https://api.github.com/repos/apache/incubator-beam/statuses/2eabfaa31fc0346b9dfab35f6f8d27fb638c0238"}}}}
{"actor":{"display_login":"amitsela"}}