We're updating the issue view to help you get more done. 

Expose Macros through the context of Script transforms

Description

If the user wants to access macros while writing script/code in Javascript/Python transforms, they have no option to do so today. The best way to expose macros, would be through the context in the script transforms. The other alternative would be to make the code field of the script transforms macro enabled but that would not be clean.

Release Notes

Added a method to get pipeline arguments in the script plugins

Activity

Show:
Ali Anwar
December 10, 2016, 12:09 AM

Isn't an alternative to specify the macro as the value of a runtime argument, and then access that runtime argument's key from the script?

Gokul Gunasekaran
December 10, 2016, 12:22 AM

I don't think there is a way to access runtime arguments from the script right now. From the plugin config property description, it says "a context object (which contains CDAP metrics, logger and lookup)".

Andreas Neumann
December 10, 2016, 1:02 AM

So, as a workaround, one could write to a KeyValueTable and use that as a lookup in the script?

Albert Shau
August 7, 2017, 8:35 PM

We can easily add a getArguments() method to the script context, which will allow users to do context.getArguments().get('arg') to get any argument

Albert Shau
August 8, 2017, 12:04 AM
Fixed

Assignee

Albert Shau

Reporter

Gokul Gunasekaran

Labels

Docs Impact

None

UX Impact

None

Components

Fix versions

Priority

Major
Configure