[ 
https://issues.apache.org/jira/browse/BEAM-7926?focusedWorklogId=332798&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-332798
 ]

ASF GitHub Bot logged work on BEAM-7926:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 23/Oct/19 18:48
            Start Date: 23/Oct/19 18:48
    Worklog Time Spent: 10m 
      Work Description: KevinGG commented on pull request #9741: [BEAM-7926] 
Visualize PCollection
URL: https://github.com/apache/beam/pull/9741#discussion_r338218993
 
 

 ##########
 File path: 
sdks/python/apache_beam/runners/interactive/interactive_environment_test.py
 ##########
 @@ -88,6 +91,72 @@ def test_watch_class_instance(self):
     self.assertVariableWatched('_var_in_class_instance',
                                self._var_in_class_instance)
 
+  def test_fail_to_set_pipeline_result_key_not_pipeline(self):
+    class NotPipeline(object):
+      pass
+
+    with self.assertRaises(AssertionError) as ctx:
+      ie.current_env().set_pipeline_result(NotPipeline(),
+                                           runner.PipelineResult(
+                                               runner.PipelineState.RUNNING))
+      self.assertTrue('pipeline must be an instance of apache_beam.Pipeline '
+                      'or its subclass' in ctx.exception)
+
+  def test_fail_to_set_pipeline_result_value_not_pipeline_result(self):
+    class NotResult(object):
+      pass
+
+    with self.assertRaises(AssertionError) as ctx:
+      ie.current_env().set_pipeline_result(self._p, NotResult())
+      self.assertTrue('result must be an instance of '
+                      'apache_beam.runners.runner.PipelineResult or its '
+                      'subclass' in ctx.exception)
+
+  def test_set_pipeline_result_successfully(self):
+    class PipelineSubClass(beam.Pipeline):
+      pass
+
+    class PipelineResultSubClass(runner.PipelineResult):
+      pass
+
+    pipeline = PipelineSubClass()
+    pipeline_result = PipelineResultSubClass(runner.PipelineState.RUNNING)
+    ie.current_env().set_pipeline_result(pipeline, pipeline_result)
+    self.assertIs(ie.current_env().pipeline_result(pipeline), pipeline_result)
+
+  def test_determine_terminal_state(self):
+    for state in (runner.PipelineState.DONE,
+                  runner.PipelineState.FAILED,
+                  runner.PipelineState.CANCELLED,
+                  runner.PipelineState.UPDATED,
+                  runner.PipelineState.DRAINED):
+      ie.current_env().set_pipeline_result(self._p, runner.PipelineResult(
 
 Review comment:
   Great, thanks! I totally missed it. I'll change it to use that class method.
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 332798)
    Time Spent: 12h 20m  (was: 12h 10m)

> Visualize PCollection with Interactive Beam
> -------------------------------------------
>
>                 Key: BEAM-7926
>                 URL: https://issues.apache.org/jira/browse/BEAM-7926
>             Project: Beam
>          Issue Type: New Feature
>          Components: runner-py-interactive
>            Reporter: Ning Kang
>            Assignee: Ning Kang
>            Priority: Major
>          Time Spent: 12h 20m
>  Remaining Estimate: 0h
>
> Support auto plotting / charting of materialized data of a given PCollection 
> with Interactive Beam.
> Say an Interactive Beam pipeline defined as
> p = create_pipeline()
> pcoll = p | 'Transform' >> transform()
> The use can call a single function and get auto-magical charting of the data 
> as materialized pcoll.
> e.g., visualize(pcoll)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to