Automation Professionals' Integration Toolkit Module

That's very helpful.
Thanks a lot Phil!

Automation Professionals is pleased to announce a beta release of this Integration Toolkit:

For Ignition v8.1+, as usual: v2.0.16.241352008

This beta introduces a number of new scripting features:

  • Inspired by @Mathias_Melling above, the souped-up dictionary functionality of the BindableVarMap data type has been factored out, as system.util.VarMap. Serializable to the extent its contents are serializable, just like dictionaries, and safe for use with persistence. :grin:

  • The PythonAsJavaException wrapper from my later.py script has been re-implemented in java as PyAsJavaException, exposed via the helper function system.reflect.asThrowable(). This implementation extracts the package to include with the function or class+method on each line of the resulting traceback. And it is serializable, suitable for inclusion in gateway network or designer/client messaging.

  • As a side-effect of the work on PyAsJavaException, system.util.getModulePath() is available for use within project library scripts. Particularly useful when naming logger instances.

And finally, something that has been percolating for a while now:

  • A solution to testing gateway code in the designer script console, in the form of a decorator for project library functions: @system.util.runInGateway. Place this decorator in front of your gateway-scope-only library function and calls from Designer or Vision Client scopes will be automatically turned into an RPC call to the gateway instance of the code, and that instance's return value passed back to the calling scope.

The above can be approximated with message handlers on a per-project basis, but that approximation suffers from significant extra opportunities for errors, and lack of parallelism at scale.

Try something like this code snippet, perhaps in toolkit:

logger = system.util.getLogger(system.util.getProjectName() + '.' + system.util.getModulePath())

@system.util.runInGateway
def gwLoggerTest(someMessage):
	logger.info(someMessage)
	return "Logged: " + someMessage

(Remember to save your project.) Then try this in the designer script console:

print toolkit.gwLoggerTest("Hold my beer!")

Then go look at your gateway logs. :grin:

{ It is a beta because travel and client crises have limited testing time... }

10 Likes