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

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

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

 ##########
 File path: sdks/python/apache_beam/runners/interactive/testing/mock_ipython.py
 ##########
 @@ -0,0 +1,67 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# Mocked object returned by invoking get_ipython() in an ipython environment.
+_mocked_get_ipython = None
+
+
+def mock_get_ipython():
+  """Mock an ipython environment w/o setting up real ipython kernel.
+
+  Each entering of get_ipython() invocation will have the prompt increased by
+  one. Grouping arbitrary python code into separate cells using `with` clause.
+
+  Examples::
+
+    # Usage, before each test function, append:
+    @patch('IPython.get_ipython', mock_get_ipython)
+
+    # Group lines of code into a cell:
+    with mock_get_ipython():
+      # arbitrary python code
+      # ...
+      # arbitrary python code
+
+    # Next cell with prompt increased by one:
+    with mock_get_ipython():  # Auto-incremental
+      # arbitrary python code
+      # ...
+      # arbitrary python code
+  """
+
+  class MockedGetIpython(object):
+
+    def __init__(self):
+      self._execution_count = 0
+
+    @property
+    def execution_count(self):
+      """Execution count always starts from 1 and is constant within a cell."""
+      return self._execution_count
+
+    def __enter__(self):
+      """Marks entering of a cell/prompt."""
+      self._execution_count = self._execution_count + 1
+
+    def __exit__(self, exc_type, exc_value, traceback):
+      """Marks exiting of a cell/prompt."""
+      pass
+
+  global _mocked_get_ipython
 
 Review comment:
   Do you need both L19 and L65 definitions for global?
 
----------------------------------------------------------------
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:
[email protected]


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

    Worklog Id:     (was: 353752)
    Time Spent: 24h 10m  (was: 24h)

> 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: 24h 10m
>  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