Article
Oliver Wilms · Feb 5 2m read

Embedded Python for iris-log-viewer conclusion

As my entry into InterSystems Developer Tools Contest happening now I have been working on an alternative to the Console Log Viewer web page provided as part of InterSystems IRIS Management Portal. Console log is a file called messages.log. It is what InterSystems support asks me to send to them when I open a support ticket. Working on IRIS containers deployed in the cloud it is not straight forward to copy the messages.log file to a place where I can attach it to an email. Iris-log-viewer app provides a Download link to download messages.log from any browser. 

 

I observed it takes a couple of seconds to read the messages.log file and import it line by line into a persistent table as I display it in my iris-log-viewer app. I have thought how I can use Embedded Python inside my app to earn additional bonus points in the contest. I want to find out if I can read the messages.log file faster in Python than it happens using IRIS objectscript code.

 

I worked yesterday to include Python code in my app where I also call an IRIS objectscript classMethod from Python classMethod. I struggled when I encountered an error while testing my Embedded Python code with a 5 MB messages.log test file. Thanks to Eduard I was able to overcome the error and he even provided suggestions to simplify my code.

 

IRISAPP>set m5mb="/home/irisowner/irisdev/messages.old_20221231.log"

 

IRISAPP>do ##class(otw.log.irislogreader).Test1(m5mb)

Test1 begins at 02/05/2023 12:49:30

ReadLogLines

/home/irisowner/irisdev/messages.old_20221231.log

Open

Test1 ends at 02/05/2023 12:49:34

Test1 execution time: 3.500789

 

 

IRISAPP>d ##class(otw.log.irislogreader).Test2(m5mb)

Test2 begins at 02/05/2023 19:44:34

1675626274.806718

1675626277.834002

Execution time:  3.0272839069366455

Test2 ends at 02/05/2023 19:44:37

Test2 execution time: 3.424064

 

I measured it took 3.5 seconds to read a 5 MB messages.log and import 63239 lines into a persistent table using IRIS objectscript code. When I ran test using Embedded Python, it took 3.424 seconds. It appears reading the file using Embedded Python is slightly faster than IRIS objectscript code.

0
0 53
Discussion (0)1
Log in or sign up to continue