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

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

                Author: ASF GitHub Bot
            Created on: 03/Dec/19 23:51
            Start Date: 03/Dec/19 23:51
    Worklog Time Spent: 10m 
      Work Description: KevinGG commented on pull request #10276: [BEAM-7926] 
Data-centric Interactive Part1
URL: https://github.com/apache/beam/pull/10276#discussion_r353484078
 
 

 ##########
 File path: 
sdks/python/apache_beam/runners/interactive/display/pipeline_graph_test.py
 ##########
 @@ -83,6 +91,45 @@ def test_get_dot(self):
          '}\n'),
         pipeline_graph.PipelineGraph(p).get_dot())
 
+  @patch('IPython.get_ipython', mock_get_ipython)
+  def test_get_dot_within_notebook(self):
+    # Assume a mocked ipython kernel and notebook frontend have been set up.
+    ie.current_env()._is_in_ipython = True
+    ie.current_env()._is_in_notebook = True
+    with mock_get_ipython():  # Cell 1
+      p = beam.Pipeline(ir.InteractiveRunner())
+      # Immediately track this local pipeline so that ipython prompts when
+      # applying transforms will be tracked and used for labels.
+      ib.watch(locals())
+
+    with mock_get_ipython():  # Cell 2
+      init_pcoll = p | 'Init' >> beam.Create(range(10))
+
+    with mock_get_ipython():  # Cell 3
+      squares = init_pcoll | 'Square' >> beam.Map(lambda x: x * x)
+
+    with mock_get_ipython():  # Cell 4
+      cubes = init_pcoll | 'Cube' >> beam.Map(lambda x: x ** 3)
+
+    # Tracks all PCollections defined so far.
+    ib.watch(locals())
+    self.assertEqual(
+        ('digraph G {\n'
+         'node [color=blue, fontcolor=blue, shape=box];\n'
+         '"Cell 2: Init";\n'
+         'init_pcoll [shape=circle];\n'
+         '"Cell 3: Square";\n'
+         'squares [shape=circle];\n'
+         '"Cell 4: Cube";\n'
+         'cubes [shape=circle];\n'
+         '"Cell 2: Init" -> init_pcoll;\n'
+         'init_pcoll -> "Cell 3: Square";\n'
+         'init_pcoll -> "Cell 4: Cube";\n'
+         '"Cell 3: Square" -> squares;\n'
+         '"Cell 4: Cube" -> cubes;\n'
+         '}\n'),
 
 Review comment:
   `Create` is a composite transform. The dot based pipeline graph only renders 
top-level transform and our label altering only happens to top-level 
transforms. So whether a transform is composite or not doesn't affect either.
 
----------------------------------------------------------------
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: 353116)
    Time Spent: 22h 20m  (was: 22h 10m)

> Show PCollection with Interactive Beam in a data-centric user flow
> ------------------------------------------------------------------
>
>                 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: 22h 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
>  
> {code:java}
> p = beam.Pipeline(InteractiveRunner())
> pcoll = p | 'Transform' >> transform()
> pcoll2 = ...
> pcoll3 = ...{code}
> The use can call a single function and get auto-magical charting of the data.
> e.g.,
> {code:java}
> show(pcoll, pcoll2)
> {code}
> Throughout the process, a pipeline fragment is built to include only 
> transforms necessary to produce the desired pcolls (pcoll and pcoll2) and 
> execute that fragment.
> This makes the Interactive Beam user flow data-centric.
>  
> Detailed 
> [design|https://docs.google.com/document/d/1DYWrT6GL_qDCXhRMoxpjinlVAfHeVilK5Mtf8gO6zxQ/edit#heading=h.v6k2o3roarzz].



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

Reply via email to