将属性传递给 spring 云数据流的组合任务运行器应用程序的子任务 [英] passing properties to child task of composed-task-runner app of spring cloud dataflow

查看:28
本文介绍了将属性传递给 spring 云数据流的组合任务运行器应用程序的子任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试运行 spring 云数据流的组合任务运行器,其中包含 2 个子任务(A 和 B).我将属性传递给 my-composed-task,它也必须传递给子任务,但它没有传递到子应用程序中.以下是我正在使用的命令:

用于在数据流 shell 中创建任务:

task create my-composed-task --definition "A &&B"

用于在数据流 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";

属性参数 deployer.composed-task-runner.local.javaOpts=-Xmx8g" 不会进入 my-composed-task 的子应用程序.

通过数据流外壳启动后,服务器显示以下创建任务的命令:

我的组合任务

oscdspi.local.LocalTask​​Launcher :要执行的命令: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

<块引用>

javaOpts 为 -Xmx8g,这是正确的

任务 A

oscdspi.local.LocalTask​​Launcher :要执行的命令: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=密码measurementyear=2020 --spring.cloud.data.flow.platformname=default --spring.cloud.task.executionid=50

<块引用>

它没有javaOpts,但它应该有

任务 B

oscdspi.local.LocalTask​​Launcher :要执行的命令: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=密码measurementyear=2020 --spring.cloud.data.flow.platformname=default --spring.cloud.task.executionid=51

<块引用>

它没有javaOpts,但它应该有

我也希望 javaOpts 出现在子任务中,可以做些什么来解决它???

提前致谢!!

解决方案

如果要将 appdeployer 属性传递给子任务,则需要引用子任务的应用程序或标签名称,以使其符合子任务的资格.

例如,在你的情况下,你需要使用这样的东西:

deployer.my-composed-task.A.local.javaOpts=-Xmx8g

您在上面的属性引用中看到组合任务的名称 my-composed-task 和子任务的名称 A.

有关这方面的更多信息,您可以查看文档这里

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!!

解决方案

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

这篇关于将属性传递给 spring 云数据流的组合任务运行器应用程序的子任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆