Getting parameters from BigInsights

270 views Asked by At

I developed a Java application and deployed it to BigInsights. But I had to give some parameters in code. How can I get them from BigInsights application page? I add input fields when i publish BigInsights project in parameters tab but how can i bind them with application? I couldn't find any documents about this.

3

There are 3 answers

0
padmalcom On

Did you check the args from you main method? Maybe you find the configured parameters in there?

0
James Taylor On

I know this is an old question but I've just been experimenting with exactly this kind of thing on BigInsights so here's what I've discovered so far.

I've created a very basic main method which just logs the arguments. To configure the BigInsights application to pass the parameter through, I did the following.

Add a ${exampleParameter} arg to my Java action in BIApp/workflow/workflow.xml

workflow.xml editor showing example parameter as a Java Action arg value

Which looks like this in the XML.

<workflow-app name="wfapp" xmlns="uri:oozie:workflow:0.2">
    <start to="java-action"/>
    <action name="java-action">
        <java>
            <job-tracker>${jobTracker}</job-tracker>
            <name-node>${nameNode}</name-node>
            <main-class>com.ibm.uk.jamest.JavaAction</main-class>
            <arg>${exampleParameter}</arg>
        </java>
        <ok to="end" />
        <error to="kill" />
    </action>
    <!-- add actions here -->
    <kill name="kill">
        <message>error message[${wf:errorMessage(wf:lastErrorNode())}]</message>
    </kill>
    <end name="end"/>
</workflow-app>

This gets picked up by the BigInsights Application Publish wizard as a parameter which you can then edit as required.

BigInsights Application Publish wizard showing example parameter being edited

Here what ends up in the BIApp/application/application.xml as a result. (It sounds like this is the bit you did.)

<application-template xmlns="http://biginsights.ibm.com/application" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <name>BIProject</name>
    <properties>
        <property isInputPath="false" isOutputPath="false" isRequired="true" label="Example parameter" name="exampleParameter" paramtype="TEXTAREA" uitype="textfield"/>
    </properties>
    <assets>
        <asset id="BIProject" type="WORKFLOW"/>
    </assets>
    <imagePath>defaultApp_L.png</imagePath>
    <categories>Sandbox</categories>
</application-template>

Once the application was published I could provide a value for the example parameter when running it ...which got passed to the main method as expected!

BigInsights console showing how the example parameter appears when running the application

These links seemed useful for putting the two bits together:

0
Clark On

The only option I've noticed so far is that after deploying the application, you may choose to specify the input path from "Parameters area" in the biginsights web console.