问题
I am trying to run composed-task-runner of spring cloud data flow, which has 2 child tasks (A and B) within it. I am passing properties to my-composed-task, which has to be passed to child tasks too, but it is not passing into the child applications. Below are the commands which I am using:
for the creation of task in dataflow shell:
task create my-composed-task --definition "A && B"
for launching the task in dataflow shell:
task launch my-composed-task --arguments "--spring.cloud.task.closecontextEnabled=true --increment-instance-enabled=true --composed-task-arguments=measurementyear=2020,--logging.level.org=ERROR,--spring.datasource.url=url,--spring.datasource.username=username,--spring.datasource.password=password" --properties "deployer.composed-task-runner.local.javaOpts=-Xmx8g"
the properties argument "deployer.composed-task-runner.local.javaOpts=-Xmx8g" is not going into the child applications of my-composed-task.
After launching through dataflow shell, server shows below commands for the task created:
my-composed-task
o.s.c.d.spi.local.LocalTaskLauncher : Command to be executed: C:\Program Files\jdk1.8.0_152\jre\bin\java.exe -Xmx8g -jar C:\Users\shivani.chittauri\Desktop\jar\composedtaskrunner-task-2.1.0.RELEASE.jar --spring.cloud.task.closecontextEnabled=true --composed-task-arguments=measurementyear=2020,--spring.messages.encoding=UTF-8,--logging.level.org=ERROR,--spring.datasource.url=url,--spring.datasource.username=username,--spring.datasource.password=password --increment-instance-enabled=true --spring.cloud.dataflow.task.platform.local.accounts.default.javaOpts=-Xmx8g --spring.cloud.data.flow.platformname=default --spring.cloud.task.executionid=49 --spring.cloud.data.flow.taskappname=composed-task-runner
It has javaOpts as -Xmx8g, which is correct
Task A
o.s.c.d.spi.local.LocalTaskLauncher : Command to be executed: C:\Program Files\jdk1.8.0_152\jre\bin\java.exe -jar C:\Users\shivani.chittauri\Desktop\jar\A-1.0-SNAPSHOT.jar --spring.datasource.username=username --spring.datasource.url=url --spring.messages.encoding=UTF-8 --logging.level.org=ERROR --spring.datasource.password=password measurementyear=2020 --spring.cloud.data.flow.platformname=default --spring.cloud.task.executionid=50
It does not has javaOpts, but it should have
Task B
o.s.c.d.spi.local.LocalTaskLauncher : Command to be executed: C:\Program Files\jdk1.8.0_152\jre\bin\java.exe -jar C:\Users\shivani.chittauri\Desktop\jar\B-1.0-SNAPSHOT.jar --spring.datasource.username=username --spring.datasource.url=url --spring.messages.encoding=UTF-8 --logging.level.org=ERROR --spring.datasource.password=password measurementyear=2020 --spring.cloud.data.flow.platformname=default --spring.cloud.task.executionid=51
It does not has javaOpts, but it should have
I want javaOpts to be present in child tasks too, what could be done to resolve it???
Thanks in advance!!
回答1:
If you want to pass the app
or deployer
properties into the child tasks, then you need to reference the app or label
name of the child task in order to qualify them for the child tasks.
For example, in your case, you need to use something like this:
deployer.my-composed-task.A.local.javaOpts=-Xmx8g
You see the name of the composed task my-composed-task
with the name of the child task A
in the above property reference.
For more information on this, you can check the documentation here
来源:https://stackoverflow.com/questions/62674066/passing-properties-to-child-task-of-composed-task-runner-app-of-spring-cloud-dat