How to pass parameters to a graph

Hello,

I have a requirement where I need to call multiple graphs by passing a parameter, e.g. the location of the input file to the DATA_READER component. I am trying to run the graph through RunGraph component and passing the parameter (location of the input file name) to that graph. However, in the graph’s DATA_READER component, I need to specify the URL of input file name, which should just be a placeholder, telling it that this parameter needs to be passed through RunGraph component. However, when I run the RunGraph component, I get the below error:

Component pre-execute initialization failed. File is unreachable: /u02/clover/cdes/${dataFileIn} caused by: java.io.FileNotFoundException: /u02/clover/cdes/${dataFileIn} (No such file or directory)

This is because I am specifying the file URL in the graph’s DATA_READER as ${dataFileIn}, which is not taken as a placeholder and is being evaluated for a location, which does not resolve to anything. I also tried to externalize the dataFileIn parameter in the RunGraph, but to no avail. Any help will be greatly appreciated.

Here is the code for RunGraph and the graph that I am trying to call from RunGraph:

Please let me know if I have missed some important detail or the code and I will post it.

Thanks!

<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>

Hello, there are to ways to pass parameters to another graph. Both require the second graph to have an internal parameter called dataFileIn defined.

Your first option is to run the second graph in the same JVM. In this case, you are able to pass parameters with the same name. In your case, you create an internal parameter dataFileIn also in your first graph and set it to desired value (${DATAIN_DIR}/test1.in). In the RunGraph component you need to set the “Graph parameters to pass” attribute to dataFileIn. When you run the graph now, the value of the dataFileIn parameter will be passed to the second graph an the second graph will be run will its dataFileIn parameter set to this value (${DATAIN_DIR}/test1.in).

The second option is to run the second graph in another JVM (“The same JVM” attribute of the RunGraph component set to false"). In this case you need to set the “Command line arguments” attribute to -P:dataFileIn=${DATAIN_DIR}/customers.dat or generaly -P:parameterName=parameterValue.