how to hide INFO in cells outputs in google colab - google-colaboratory

How do I hide info in output cells in Google Colab and only show the result of the code and not the INFO lines?

This is not a Colab issue. What you are seeing is the output from Python's logging module that is produced inside the pycaret library's code. You can turn it off by setting the logging level of the specific library to a level higher than INFO, by running these lines before your pycaret code:
import logging
logging.getLogger("pycaret").setLevel(logging.WARNING) # see docs for other logging levels
or disabling logging altogether with
logging.disable(logging.CRITICAL)

Related

Profiling code not working for Odoo version 15.0

I am adding profiler on my custom method on Odoo v15.0
I have referred below doc for code profiling
https://www.odoo.com/documentation/15.0/developer/howtos/profilecode.html
Below is the syntax i am using
from odoo.tools.profiler import profile
#profile
#api.model
def mymethod(...):
My code
But on execution of code i am getting below error on terminal
"ImportError: cannot import name 'profile' from 'odoo.tools.profiler'"
To debug the issue i have deep dived in base code of "/odoo/tool/profiler.py".
But unable to locate any wrapper or function called profiler.
What is correct way to use profiling using "Log a method" strategy on odoo v15.0?
Goto path and make sure you have this file for line-by-line code profiling looks like you don't have this file
From the front end in debug mode open enable profiling, this will give you all the information per user

Any way to avoid the runtime restart when upgrading `google-cloud-language` in Google Colab?

I'm using Google's Natural Language API to run sentiment analysis on text blocks, and according to some instructions I'm following, I need t be using the latest version of google-cloud-language.
So I'm running this at the start of my Colab notebook.
!pip install --upgrade google-cloud-language
When I get to the end of that, it requires me to restart the runtime, which means I can't automatically run this along with my entire code, instead having to manually attend to the runtime restart.
This SO post touches on the topic, but only offers the 'crash' solution, and I'm wondering if anything else is available now 3 years later.
Restart kernel in Google Colab
So I'm curious if there's any workaround, or way to permanently upgrade google-cloud-language to avoid that?
Thank you for any input.
Here's the NL code I'm running, if helpful.
# Imports the Google Cloud client library
from google.cloud import language_v1
# Instantiates a client
client = language_v1.LanguageServiceClient()
def get_sentiment(text):
# The text to analyze
document = language_v1.Document(
content=text,
type_=language_v1.types.Document.Type.PLAIN_TEXT
)
# Detects the sentiment of the text
sentiment = client.analyze_sentiment(
request={"document": document}
).document_sentiment
return sentiment
dfTW01["sentiment"] = dfTW01["text"].apply(get_sentiment)

How to utilize data in xml from flow monitor

I want to use ns3 to calculate TCP throughput,and I think one way to track network status is using flow monitor.However,it gives out xml file and I do not know how to use it...Can anyone help how to use the data or how to find relative tutorials of utilizing data generated by flow monitor in ns3 document?
The data in FlowMonitor.xml can be viewed using NetAnimator.
Install NetAnim, see the requirements
Add the netanim-module libraries in your simulation code
Configure the node animations, see the example in src/netanim/examples/grid-animation.cc
std::string animFile = "grid-animation.xml";
AnimationInterface anim (animFile);
Run the simulation
Open the Netanim folder and run ./NetAnim
Open XML trace file
On the Stats tab change the IP-MAC switch to Flow-monitor
Select flow-monitor file and open
Select the flows of your interest
Ready! Good simulations!

pyEZ : how to get junos default groups

I am working on a project to automate junos firewall policy creation workflow. I found pyEZ as the most viable option for my case.
Although I am able to retrieve the complete configuration from the device in xml format by using rpc.get_config() method. Unfortunately I don't see the default junos applications inside the retrieved xml file. But I can see them when running the commands manually on the device
show configuration groups junos-defaults applications | display set
set groups junos-defaults applications application junos-ftp application-protocol ftp
...
Please find the snippet below that am using currently to get the config
from jnpr.junos import Device
from lxml import etree
dev = Device(host='xxxx', user='demo', password='demo123', gather_facts=False)
dev.open()
cnf = dev.rpc.get_config()
print etree.tostring(cnf)
dev.close()
Please let me know if there is any such method available to get the default application group details.
Many thanks,
Prabir
check if this helps
dev.rpc.get_config(filter_xml='<groups><name>junos-defaults</name></groups>')

Errors printed to stdout with validation layers, but no callback

I've followed this tutorial and when setting up validation layers the author says we have to setup debug callbacks so logs can be printed in stdout.
I didn't set them up and yet the application is printing various error messages in my terminal : Swapchain(ERROR): object 0x1cdd2d0 type: 1 location: 292 msgCode: 3: VkDestroyInstance() called before all of its associated VkSurfaceKHRs were destroyed for instance, when omitting the call to vkDestroySurfaceKHR.
I'm using VK_LAYER_LUNARG_standard_validation, and no particular extension (only VK_KHR_surface and VK_KHR_xcb_surface).
Is this expected behaviour?
The default logging behavior for the validation layers was changed back around June 1 because people wanted the messages to go to stdout without having to provide a callback or putting a vk_layer_settings.txt in the application's directory. The tutorial website might be out of date in this area.
If this is unwanted behavior, the easiest way to change it is to get a copy of vk_layer_settings.txt (shipped in SDK) and edit it to change the behavior to what you want, and then place it in what is the current directory when the application starts.
As an alternative, you can also code a debug callback.
For more info, please see the layer docs on the LunarXchange website.