{"id":83,"date":"2023-11-06T17:48:19","date_gmt":"2023-11-06T17:48:19","guid":{"rendered":"https:\/\/blog.dataplatform.lt\/?p=83"},"modified":"2023-11-06T17:48:19","modified_gmt":"2023-11-06T17:48:19","slug":"debugging","status":"publish","type":"post","link":"https:\/\/blog.dataplatform.lt\/?p=83","title":{"rendered":"Debugging"},"content":{"rendered":"\n<p>Lost why your pipeline breaks? Add print statement (typically combining with existing program immediately, for example by throwing exception):<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh7-us.googleusercontent.com\/YdQ5-zzBNOc1asj16FXxpKmkGuK9UATeRCbQwH61nVYhgLINhEkmILg5eypJ2dc3ksR6ITSQ4XwBsUH7ZYiXQagMU_jfqMg-BIDYYwMZTLgfVqP-Fy7X3HZ4wqTr5S2BCpXUFiGBcl2TNNbqEBOemd8\" width=\"587\" height=\"343\"><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>Now check intermediate print results shown in output<\/p>\n\n\n\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh7-us.googleusercontent.com\/-S20jkzOWKvQF-z7s1-_-713cuT2lU0EoflWYsGgezUnVRSACk-KqxgZDX6m1J4kkfzRnRswPtf9Nr_bDd486q_PQIbGGAwFKCkbrOsNyPSskzvTsk699WZm6vlvCArOVxmXH4E2-2GEUPdSB5jtNGw\" width=\"587\" height=\"799\"><\/p>\n\n\n\n<p>Another approach to debug is simply use stderr to print intermediate debug output. The pattern is as following:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import sys\nprint('This is an error message', file=sys.stderr)\n\n# Output:\n# This is an error message<\/code><\/pre>\n\n\n\n<p class=\"has-light-blue-background-color has-background\">Tip: data platform will only read sys.stdout as an output. You can use this as afeature: if you need to have some print statements (for example, statistics of each step in pipeline), you can route them to stderr.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Lost why your pipeline breaks? Add print statement (typically combining with existing program immediately, for example by throwing exception): Now check intermediate print results shown in output Another approach to debug is simply use stderr to print intermediate debug output. The pattern is as following: Tip: data platform will only read sys.stdout as an output. &hellip; <a href=\"https:\/\/blog.dataplatform.lt\/?p=83\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Debugging&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-83","post","type-post","status-publish","format-standard","hentry","category-workflow"],"_links":{"self":[{"href":"https:\/\/blog.dataplatform.lt\/index.php?rest_route=\/wp\/v2\/posts\/83","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.dataplatform.lt\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.dataplatform.lt\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.dataplatform.lt\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.dataplatform.lt\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=83"}],"version-history":[{"count":1,"href":"https:\/\/blog.dataplatform.lt\/index.php?rest_route=\/wp\/v2\/posts\/83\/revisions"}],"predecessor-version":[{"id":85,"href":"https:\/\/blog.dataplatform.lt\/index.php?rest_route=\/wp\/v2\/posts\/83\/revisions\/85"}],"wp:attachment":[{"href":"https:\/\/blog.dataplatform.lt\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=83"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.dataplatform.lt\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=83"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.dataplatform.lt\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=83"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}