3

I may be missing something since propagate-configuration does not seem to be working for me.

I have a base workflow base.xml, with configuration:

<global>
    <job-tracker>${jobTracker}</job-tracker>
    <name-node>${nameNode}</name-node>
    <job-xml>application-config.xml</job-xml>   
    <configuration>
        <property>
            <name>paths.prefix.metadata</name>
            <value>${nameNode}${fimProcessingMetadataPath}</value>
        </property>
    </configuration>
</global>

And in this very file, I have sub-workflows defined like this:

<action name="srv_a">
    <sub-workflow>
        <app-path>${nameNode}${workflowPath}/a.xml</app-path>
        <propagate-configuration />
    </sub-workflow>
    <ok to="b" />
    <error to="kill" />
</action>
<action name="srv_b">
    <sub-workflow>
        <app-path>${nameNode}${workflowPath}/b.xml</app-path>
        <propagate-configuration />
    </sub-workflow>
    <ok to="c" />
    <error to="kill" />
</action>
// Here there are many sub-workflows like these.

But then in my code, I cannot find the paths.prefix.metadata property - it fails to find it.

java.lang.IllegalArgumentException: Mandatory property property is not set.     
Please provide paths.prefix.metadata

If I define it again in a.xml as its own property, I can access it OK.

So, how can I propagate this variable from base.xml definition to the sub-workflows? As I understand from the documentation:

The propagate-configuration flag, if present, indicates that the workflow job configuration should be propagated to the child workflow.

But it does not seem to reach the child workflow. Why? Is it not an expected behaviour that the global configuration is not propagated to the child sub-workflows?

4

2 回答 2

2

I ran into the same problem. After some scrambling, the workaround I found working is to add a configuration section within sub-workflow in base xml. The properties inside the config section will be passed down to sub-workflow, e.g.:

...
<action name="srv_b">
  <sub-workflow>
    <app-path>a.xml</app-path>
    <propagate-configuration />
    <configuration>
      <property>
        <name>paths.prefix.metadata</name>
        <value>${nameNode}${fimProcessingMetadataPath}</value>
      </property>
      ...
    </configuration>
  </sub-workflow>
</action>
于 2015-02-05T22:15:25.663 回答
0

works only for passing the job.properties file. to pass variables of global section to subworkflow, we need to pass inside the section of the subworkflow.

于 2016-11-29T05:20:45.153 回答