英文:
Setting global properties in Composed Task which would be accessible in each of subtasks
问题
为子任务设置'common'属性无法工作
我使用的SCDF版本是2.9.6。
我想要创建CTR A-B-C,每个任务都执行以下操作:
A:在某个源数据库上执行SQL查询
B:处理A获取的数据库数据
C:在某个目标数据库上执行SQL插入
使这个工作的最简单方法似乎是定义共享的工作目录文件夹路径“some_work_directory”,并将其作为应用程序属性传递给A、B、C。在{some_work_directory}下,我只是将每个任务的结果存储为文件,比如select.result
、process.result
、insert.result
,然后按顺序访问它们。如果没有先例数据,我可以假设出现了问题,并使任务退出并返回1。
================
我尝试使用一个组合任务实例“QWER”,其中有两个来自同一个应用程序“global”的任务,分别命名为“A”和“B”。这个简单的应用程序会将“test.value”应用程序属性打印到控制台上,默认情况下,如果没有提供其他属性,它的值为“test”。
如果我尝试在SCDF启动构建器的全局选项卡中设置“test.value”,则它会在组合任务的日志中被解释为“app.*.test.value”。然而,SCDF在子任务A、B的日志中并没有捕获到来自父任务的此配置。它们都无法解析在启动时提供的输入。
如果我尝试在启动构建器中将“test.value”设置为行,并像在任务不组合的情况下一样将任何值传递给A、B,这甚至也失败了。我知道这不是我需要的“全局”设置,似乎CTR与SCDF启动构建器的工作方式不正确。
我找到的唯一解决方法是在启动的自由文本中手动设置app.QWER.A.test.value=AAAAA
和app.QWER.B.test.value=BBBBB
。这样,输入会被转换为app.QWER-A.app.global4.test.value=AAAAA, app.QWER-B.app.global4.test.value=BBBBB
,并正常打印。
我理解,通过这种方式,我可以在启动时为每个子任务设置详细的配置。然而,如果我只想设置一些在一个CTR实例中的任务之间共享的“全局”配置,似乎没有可行的方法。
我是否遗漏了什么?提前感谢您提供的任何信息。
英文:
Setting 'common' properties for child tasks is not working
The SCDF version I'm using is 2.9.6.
I want to make CTR A-B-C, each of tasks does follows:
A : sql select on some source DB
B : process DB data that A got
C : sql insert on some target DB
Simplest way to make this work seems to define shared work directory folder Path "some_work_directory", and pass it as application properties to A, B, C. Under {some_work_directory}, I just store each of task result as file, like select.result
, process.result
, insert.result
, and access them consequently. If there is no precedent data, I could assume something went wrong, and make tasks exit with 1.
================
I tried with a composed task instance QWER
, with two task from same application "global" named as A
, B
. This simple application prints out test.value
application property to console, which is "test" in default when no other properties given.
If I tried to set test.value in global tab on SCDF launch builder, it is interpreted as app.*.test.value
in composed task's log. However, SCDF logs on child task A, B does not catch this configuration from parent. Both of them fail to resolve input given at launch time.
If I tried to set test.value as row in launch builder, and pass any value to A, B like I did when task is not composed one, this even fails. I know this is not 'global' that I need, it seems that CTR is not working correctly with SCDF launch builder.
The only workaround I found is manually setting app.QWER.A.test.value=AAAAA
and app.QWER.B.test.value=BBBBB
in launch freetext. This way, input is converted to app.QWER-A.app.global4.test.value=AAAAA, app.QWER-B.app.global4.test.value=BBBBB
, and print well.
I understand that, by this way, I could set detailed configurations for each of child task at launch time. However, If I just want to set some 'global' that tasks in one CTR instance would share, there seems to be no feasible way.
Am I missing something? Thanks for any information in advance.
答案1
得分: 1
CTR将协调执行一系列任务。任务之间没有隐式数据传输。如果您希望从A获取数据作为B的输入,然后B的输出成为C的输入,您可以创建一个具有由处理器连接的读取器和写入器的任务/批处理应用程序,或者您可以为B创建一个流应用程序,并使用JDBC源和A和C的接收器。
英文:
CTR will orchestrate the execution of a collection of tasks. There is no implicit data transfer between tasks. If you want the data from A to be the input to B and then output of B becomes the input of C you can create one Task / Batch application that have readers and writers connected by a processor OR you can create a stream application for B and use JDBC source and sink for A and C.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论