Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Dev Space

Customize and extend the power of Alteryx with SDKs, APIs, custom tools, and more.
SOLVED

Batch Macro Error with Python SDK Tool

jraad
6 - Meteoroid

Hello! I've built out a tool using the Alteryx Python SDK and it is working perfectly when testing on single test cases. I built a batch macro wrapper containing this new tool, and now I'm intermittently encountering an ambiguous bug error (pictured below).

 

SDKBatchError.PNG

The error is not specific to Record #3 - in fact, the error will occur at a different record each time I run it. Tool #3 is the P macro output tool in the batch macro (macro contents pictured below - two files are read in and passed to the Python SDK based module).

MacroContents.PNG

I know this isn't much to work off of (especially because the error message is vague) but does anyone have thoughts on tracking down the issue?

 

3 REPLIES 3
MichaelCh
Alteryx
Alteryx

This could be a bug in the SDK, or it could be a bug in your Python tool. Can you share your tool with us?

 

My suspicion would be that it has nothing to do with the macro. As a starting point, perhaps you could begin by simplifying the workflow one tool at a time until you find the minimum number of tools required to reproduce the issue. The next step after that would be to start simplifying the plugin itself, one code change at a time, until you find the simplest set of code that reproduces the issue. If you can share *that* code (and the simpler workflow) with us, that will make it easiest to help you solve your problem. This is also known as an MCVE. Sometimes just making the MCVE reveals the problem.

jraad
6 - Meteoroid

Worked with Michael to troubleshoot the code and he found that the output anchors in the Python SDK tool were not being properly closed prior to pi_close running. Adding statements to close each anchor resolved the issue! This was only causing a problem when a summary tool was being used downstream from the SDK tool.

MichaelCh
Alteryx
Alteryx

Yes, you must always remember to close your output anchors when you've finished pushing records to them. This should happen no later than pi_close. Without closing your output anchors, downstream tools have no way to know that you're done sending them data--and that's a major issue for tools like sort or summarize that don't *really* start doing the work until they know they have everything.