Vlad Dumitrascu
04/12/2021, 10:22 PMsandy
04/12/2021, 11:02 PMVlad Dumitrascu
04/13/2021, 6:42 PMRaw Step Out
, it's blank. I literally just need whatever is output when I type print()
in a python module I've imported and used in a dagster @solid
. I think some modules (like Autodesk Maya's python API) re-direct their prints to STDOUT, but I can't depend on that behavior.
So, more specifically, is there something I need to do with dagster to redirect, or expose, or whatever the terminology is - to just make it so whenever I have typed print('some text')
in an imported module, I get the same result as <http://context.log.info|context.log.info>('some text')
in my @solid
usage.
Does that make sense? I don't know if I'm being clear...sandy
04/14/2021, 4:25 AMSimon Späti
04/14/2021, 8:47 AMalex
04/14/2021, 4:02 PMVlad Dumitrascu
04/14/2021, 5:54 PMprint()
statements in the dagit : playground or runs console output views(not sure of their actual name, but the views you see in dagit as it's running a pipeline.). Right now, I have a work-around where I just have to code up <http://context.log.info|context.log.info>()
into the @solid function any time I want to print something for my users to see there. You see, I intend to share a dagit link to my users to expose launching pipelines and viewing the run results. So, they will see dagit in their browser, but have no access to the command shell running on my PC serving out dagit. So, if it doesn't print to the dagit UI, it's invisible to my users( or they could expand that raw step output
, as you pointed out ...but so far, for me, it's blank). Maybe I have something wrong on my end. I hope this thread helps others. I'm kind of abandoning this as I need to move on, but it's not really resolved, for me. The reason this is important is:
1. I will probably want to leverage other, previously built, internal, python modules in my @solids. Those modules (built for python standalone) often print up very useful information as they go. It's unreasonable to have to re-write those modules inside of a @solid, because we already have a somewhat robust little library, and why duplicate everything when you can just import it? Seems very un-pythonic, or bad project organization practice to not be able to re-use those because you can't depend on their print() output.
2. I may not have access to re-write those python modules. They are used by other teams, and I may not be able to re-configure their signature to play nicer with dagster-specific features. So, I have to operate by 'if it works in python standalone, it should be able to work by import in dagster' rule.
For now, I guess I have to just re-build each feature inside an @solid. I guess I have to replace imported non-standard libraries with custom @solids, basically copy-paste the code from my module to the inside of the @solid function, and change any print()
statement to <http://contex.log.info|contex.log.info>()
. This will be annoying, but I guess this ensures reliable behavior in dagit, and maybe gives me some option to do something custom for dagit.
Correct me if I'm wrong. Hope this helps others.