Support Questions

Find answers, ask questions, and share your expertise
Announcements
Check out our newest addition to the community, the Cloudera Data Analytics (CDA) group hub.

Control what is printed in the output console

New Contributor

Moving from Jupyter to CDSW I struggle to get along with the output console. Is it possible to suppress output of every single line from the source code? I find the output too verbose and would like to see the output from the print statements only.

 

When using Matplotlib I would also like to suppress the output from plots until I do the plt.show() command. In order to suppress text output from plt.hist(...) I do

 

_ = plt.hist(...)

 

Is there a better way of stopping CDSW from printing in the output console?

5 REPLIES 5

Master Collaborator

CDSW just uses the Jupyter kernel, so much of what you do in the Jupyter notebook would work here too. Magics will work. There's also an option to suppress this output in the output that is shared in the "Share" link, but that's not quite what you mean.

New Contributor

I just discovered that putting a semicolon (;) at the very end of the code suppresses implicit output when running all lines. However, adding a semicolon at the end of a specific line seems to have no effect.

 

Googling these issues lead to the magic command capture, however, it seems to be of no use:

 

> %capture
ERROR:root:Line magic function `%capture` not found (But cell magic `%%capture` exists, did you mean that instead?).
> %%capture
UsageError: %%capture is a cell magic, but the cell body is empty.

In other words, I still feel that I do not have control of the output. If I select a block of code I'd like to suppress the output of the source code when running this particular block.

 

I struggle to find information online about what magic commands (regarding output) are available in CDSW and how they work.

New Contributor

I would also like to know the best way to toggle the output in the console window. Today somehow I'm seeing the opposite problem of only seeing lines explicitly called to print, but sometimes all the executed code will show as well. I'm also seeing only print lines show up in the emailed job output.

 

There is a collapse button, but that seems to collapse everything but comment lines preceded with #.

 

Explorer

@dustbite I am facing the same problem and would like to mask the code being printed on the email sent at the end of job execution. Did you happen to resolve it? Any help is appreciated.

Community Manager

@MadhuNP As this is an older post, you would have a better chance of receiving a resolution by starting a new thread. This will also be an opportunity to provide details specific to your environment that could aid others in assisting you with a more accurate answer to your question. You can link this thread as a reference in your new post.


Regards,

Diana Torres,
Community Moderator


Was your question answered? Make sure to mark the answer as the accepted solution.
If you find a reply useful, say thanks by clicking on the thumbs up button.
Learn more about the Cloudera Community:
Take a Tour of the Community
Don't have an account?
Your experience may be limited. Sign in to explore more.