cancel
Showing results for 
Search instead for 
Did you mean: 

How to see the outputs and logs of the a python script?

irsl
New Contributor II

I have a pipeline which included a python script. Although the pipeline works properly but I cannot see the output of my script both in the data preview and also in the logs. E.g. when I download the logs I dont see this output:
self.log.info(" This is a python log")

Also the data preview somehow does not work for this specific pipeline although there is no special character in the project name which apparently is a known bug.
self.output.write("This is a python output")

Any idea on this would be appreciated.

image

6 REPLIES 6

irsl
New Contributor II

Thank you both for the help and for the detailed answers. The issue with this specific pipeline is still not solved though.

  • I always do the validation before running the pipeline (in fact each pipeline saving will automatically validate the pipeline) and still this specific pipeline does not show any data preview. This could be the result of having custom snaps specific for connecting to our internal platform to read and write data. Other pipelines which includes python scripts do not have such an issue.
  • @rsramkosk When I validate your pipeline I can see both the data preview and the python logs (via Dashboard). But for my own pipeline this is not the case. The main pipeline invokes multiple child pipelines and the logs of the parent pipeline should include the all the script logs. The python script runs some command lines in a mounted storage. Still not sure what happens to the log afterwards.
  • @rsramkosk a question/feedback on your UntarFile workflow: Could it be that pipe.tmpDir in some instances couldn’t be accessed because of the different admin configurations? When I validate/run your workflow I get this error: Failure: Error browsing the directory contents. /logs/snaplogic/tmp/sl_pipe_5e31419d06650079bd2a0fb7_5c211261-c4d8-41b5-bbaa-e054812628f3, Resolution: Please try again.

Thank you for the help.

@irsl Your observation about the custom snap is significant here as that could definitely be why you aren’t seeing any preview data from the Script Snap - if no preview data goes in, no preview data comes out (unless the Script Snap itself is making a connection to a target to pull data).

From your third point, it does sound like your temp location has been redirected to /logs/snaplogic which is not a default directory that we create, so you would have to check with your infrastructure or system administrators on that point. Our default logging location on Linux would be /opt/snaplogic/run/logs.

Considering the custom Snap, custom logging location, and temp folder location, you may need work with Support to move this situation forward unless you can post more detail here about the custom Snap, temp folder permissions, and Script Snap code.