Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove stdout/stderr from predefined visualization #1976

Prev Previous commit
Next Next commit
Added simpler way to hide logging for non-custom visualizations
  • Loading branch information
ajchili committed Aug 29, 2019
commit d67fe29914ea3aa523ec4ed3776d06d1a23d33b5
7 changes: 3 additions & 4 deletions backend/src/apiserver/visualization/exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,9 @@ def create_cell_from_file(filepath: Text) -> NotebookNode:
NotebookNode with specified file as code within node.

"""
with open(filepath, 'r') as f:
code = f.read()

return new_code_cell(code)
cell = new_code_cell("%run {}".format(filepath))
cell.get("metadata")["hide_logging"] = not filepath.startswith("types/custom")
return cell


def create_cell_from_custom_code(code: list) -> NotebookNode:
Expand Down
5 changes: 5 additions & 0 deletions backend/src/apiserver/visualization/templates/basic.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -64,19 +64,24 @@ unknown type {{ cell.type }}
{%- endblock execute_result %}

{% block stream_stdout -%}
{% if not cell['metadata'].get('hide_logging', True) %}
<div class="output_subarea output_stream output_stdout output_text">
<pre>
{{- output.text | ansi2html -}}
</pre>
</div>
{% endif %}
{%- endblock stream_stdout %}


{% block stream_stderr -%}
{% if not cell['metadata'].get('hide_logging', True) %}
<div class="output_subarea output_stream output_stderr output_text">
<pre>
{{- output.text | ansi2html -}}
</pre>
</div>
{% endif %}
{%- endblock stream_stderr %}

{% block data_svg scoped -%}
Expand Down