Jump to content

Make IronPython script wait for completion of data function called within the script


Mark Herrmann

Recommended Posts

Hi there,

when I had to call a data function from an IronPython script and I wanted the script to pause until the data function had completed, I've been using the concept shown here and here in the past w/o any problems. Quoting from the 2nd link: "... by using the method DataFunction.ExecuteSynchronously(). Execution of the remainder of the IronPython script is then blocked until the data function completes."

# 1st part of the IronPython script

do something....

 

# Call a data function in a way that the 2nd part of this script

# is only executed, when the data function is completed

dm=Application.GetService(DataManager)

for function in dm.DataFunctions:

if function.Name == "MyFunction":

function.ExecuteSynchronously()

 

# 2nd part of the IronPython script which relies on updated output from MyFunction

do something else...I have tried to apply this to a C# based data function (so not a TERR or Python) and it does not seem to work (the 2nd part is throwing errors indicating that the data function has not completed when the 2nd part is being executed).

So now my question is: is that quote above simply incorrect and I had misunderstood the concept of ExecuteSynchronously() all the time or this only working for TERR/Python data functions

Thanks, Mark

Link to comment
Share on other sites

Hello,

 

Having just consulted with a TIBCO resource that is quite knowledgeable in this general area, who also found the behaviour you described to be unexpected, I recommend that you open a support case for this in the TIBCO Support Portal (https://support.tibco.com), and the support team will assist you with further troubleshooting.

 

Best Regards

Fredrik Rosell (TIBCO)

Link to comment
Share on other sites

Hi Fredrik,

thanks for the feedback! I also had a chat with someone quite knowledgable from the TIBCO team (author of the comprehensive primer) and he said that in fact it should work for a C# data function as well.

So I went back and further investigatet the error that got me thinking that the data function had not completed when the 2nd part of the script was executed. Turns out that you get the same error "column xyz does not exist" if that column (being an output of the data function) is not yet available or if you simply misspell the column name in the script...

That said, it all works as expected and I will not bother Tibco support with my spelling qualification.

Sorry for the confusion and thanks again for looking into this!

Mark

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...