Forum Discussion
Hello venkat475,
I'm not sure but, this might be also possible to be achieved using SnapLogic expressions and parsing / formatting workarounds.
However if you have no other option, then you can use the Script Snap and the subprocess Python module to execute UNIX command directly on the Snaplex Node.
Regards,
Aleksandar.
Could you please provide the sample script snap how to include the python code within the existing python code which is there script snap
- ptaylor5 years agoEmployee
Yes, we still use the Nashorn engine for JavaScript. It’s deprecated but still present in Java 11.
I can’t speak to how anyone debugs their JS scripts.
- ForbinCSD5 years agoContributor
Thanks for the rapid reply!
I’m hoping that a long-term Snaplogic user might chirp up with some phenomenally useful tricks that let me find problem code in our JS snaps and fix it.
- akidave5 years agoEmployee
For most transformations, the SnapLogic expression language can be used. We support dynamic validations, which enables rapid prototyping and development.
For more complex requirements, a custom Snap can be developed in Java. Full IDE support is possible through debugger support. A custom snap has performance advantages over a Script snap when the document count is large, but the development of the custom snap does require more effort.
For the Script snap, using log statement to debug the script is one approach. Another approach is to develop the script outside of SnapLogic, using the command-line version of the language to test the script and then upload the script into SnapLogic. This works well for Jython, I believe the same approach works for JavaScript.
- ForbinCSD5 years agoContributor
I’ve been able to do a little experimentation using Microsoft Visual Studio Code using its built-in JS debugger. And I think one of my colleagues may be close to getting it to work with NCDbg + Nashorn + Java11 (same JVM distro our GroundPlexes use).
But it requires commenting out a LOT of the SnapLogic infrastructure so that what one is debugging is only marginally like the code that gets executed in the Snap.
In particular, it would be helpful to be able to fake a doc stream, and to be able to instantiate a copy of “impl” and debug the execute method. But that requires fake versions of (input,output,error,log).
Can you please ask around within Development about this? I imagine someone there might have built some scaffolding or a test jig where they could run a script externally with some faked inputs.
For that matter, since we’re exclusively on GroundPlexes, and the WAR files are right there, I imagine there might even be a way to import some of that?
Thanks!!
@ForbinCSD aka JohnB