def test_emit_graph_render_event_when_registered():
    conf.override(conf.events_handler.__name__, events.handler)
    event_name = GRAPH_RENDER_EVENT
    graph_type = 'Bar'

    kwargs_list = [(INSTANCE_ID, get_instance_id()), (EVENT_NAME, event_name),
                   (TIMESTAMP, time_stamp), (GRAPH_TYPE, graph_type)]

    events.emit_graph_render_event(graph_type)

    events.get_utc_date_time.assert_called_with()
    assert not events.handler.handle_event.called
Esempio n. 2
0
    def _register_auto_viz(self):
        from sparkmagic.utils.sparkevents import get_spark_events_handler
        import autovizwidget.utils.configuration as c
        
        handler = get_spark_events_handler()
        c.override("events_handler", handler)
        
        register_auto_viz_code = """from autovizwidget.widget.utils import display_dataframe
ip = get_ipython()
ip.display_formatter.ipython_display_formatter.for_type_by_name('pandas.core.frame', 'DataFrame', display_dataframe)"""
        self._execute_cell(register_auto_viz_code, True, False, shutdown_if_error=True,
                           log_if_error="Failed to register auto viz for notebook.")
        self.logger.debug("Registered auto viz.")
Esempio n. 3
0
    def _register_auto_viz(self):
        from sparkmagic.utils.sparkevents import get_spark_events_handler
        import autovizwidget.utils.configuration as c
        
        handler = get_spark_events_handler()
        c.override("events_handler", handler)
        
        register_auto_viz_code = """from autovizwidget.widget.utils import display_dataframe
ip = get_ipython()
ip.display_formatter.ipython_display_formatter.for_type_by_name('pandas.core.frame', 'DataFrame', display_dataframe)"""
        self._execute_cell(register_auto_viz_code, True, False, shutdown_if_error=True,
                           log_if_error="Failed to register auto viz for notebook.")
        self.logger.debug("Registered auto viz.")
Esempio n. 4
0
def test_emit_graph_render_event_when_registered():
    conf.override(conf.events_handler.__name__, events.handler)
    event_name = GRAPH_RENDER_EVENT
    graph_type = 'Bar'

    kwargs_list = [(INSTANCE_ID, get_instance_id()),
                   (EVENT_NAME, event_name),
                   (TIMESTAMP, time_stamp),
                   (GRAPH_TYPE, graph_type)]

    events.emit_graph_render_event(graph_type)

    events.get_utc_date_time.assert_called_with()
    assert not events.handler.handle_event.called