spring 设置SCDF CTR以在步骤完成时立即执行下一任务

gxwragnw  于 2023-01-25  发布在  Spring
关注(0)|答案(1)|浏览(141)

我使用的是SCDF 2.9.6,它是mariadb 10.3.x(我公司使用的,不能更新版本),与flyway兼容。编译SCDF 2.10.x项目时,使用较低的flyway依赖导致整个编译过程失败...我想这是我能使用的最高版本。
现在问题出现了,当我必须设置2.9.x版本不支持的合成任务运行器属性时-在2.9.x中设置app.composed-task-runner.interval-time-between-checks属性似乎不起作用,所以我必须找到演练。我知道这个运行器是Spring批处理项目,所以添加了Spring批处理标签。
有一个简单的组合任务asdf 1,它依次运行a、B、c、d、e任务。
每个子任务都不重--它们在5秒内完成任务。然而,CTR在10秒后执行下一个任务(步骤)。
似乎在某些属性文件中,组合任务运行器中的每个任务(步骤)都有一个“最小运行时间”。
在较低的SCDF版本中,是否有办法将此最小运行时间设置为0,以便任务(步骤)始终在前趋任务完成时执行?
感谢您就此问题提供的任何信息。
第一节第一节第一节第一节第一次

jdzmm42g

jdzmm42g1#

属性intervalTimeBetweenChecks也存在于2.9.x中。
documentation显示如何设置合成任务运行程序的属性。
app.composed-task-runner.interval-time-between-checks=1000将其设置为1秒。
我做了一个快速测试,使用kail -ns=default | tee pods.log合并所有日志,我使用5s,日志显示a的最后一个日志条目和b的第一个日志条目之间有7s,这将包括启动容器和应用程序处于活动状态的时间。

default/ctr-pg4n5m85q4[ctr-wrvzxj6x05]: 2023-01-20 12:17:31.755  INFO 1 --- [           main] o.s.b.c.l.support.SimpleJobLauncher      : Job: [FlowJob: [name=ctr]] launched with the following parameters: [{run.id=3}]
default/ctr-pg4n5m85q4[ctr-wrvzxj6x05]: 2023-01-20 12:17:31.762  INFO 1 --- [           main] o.s.c.t.b.l.TaskBatchExecutionListener   : The job execution id 11 was run within the task execution 22
default/ctr-pg4n5m85q4[ctr-wrvzxj6x05]: 2023-01-20 12:17:31.773  INFO 1 --- [           main] o.s.batch.core.job.SimpleStepHandler     : Executing step: [ctr-a_0]
default/ctr-a-q30xnqr0r4[ctr-a-mgy3nlpym5]: 2023-01-20 12:17:34.893  INFO 1 --- [           main] io.spring.timestamp.TaskApplication      : Starting TaskApplication v2.0.2 using Java 1.8.0_352 on ctr-a-q30xnqr0r4 with PID 1 (/workspace/BOOT-INF/classes started by cnb in /workspace)
default/ctr-a-q30xnqr0r4[ctr-a-mgy3nlpym5]: 2023-01-20 12:17:34.895  INFO 1 --- [           main] io.spring.timestamp.TaskApplication      : No active profile set, falling back to 1 default profile: "default"
default/ctr-a-q30xnqr0r4[ctr-a-mgy3nlpym5]: 2023-01-20 12:17:35.363  INFO 1 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...
default/ctr-a-q30xnqr0r4[ctr-a-mgy3nlpym5]: 2023-01-20 12:17:35.533  INFO 1 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Start completed.
default/ctr-a-q30xnqr0r4[ctr-a-mgy3nlpym5]: 2023-01-20 12:17:35.548 DEBUG 1 --- [           main] o.s.c.t.c.SimpleTaskAutoConfiguration    : Using org.springframework.cloud.task.configuration.DefaultTaskConfigurer TaskConfigurer
default/ctr-a-q30xnqr0r4[ctr-a-mgy3nlpym5]: 2023-01-20 12:17:35.548 DEBUG 1 --- [           main] o.s.c.t.c.DefaultTaskConfigurer          : No EntityManager was found, using DataSourceTransactionManager
default/ctr-a-q30xnqr0r4[ctr-a-mgy3nlpym5]: 2023-01-20 12:17:35.641 DEBUG 1 --- [           main] o.s.c.t.r.s.TaskRepositoryInitializer    : Initializing task schema for postgresql database
default/ctr-a-q30xnqr0r4[ctr-a-mgy3nlpym5]: 2023-01-20 12:17:35.714 DEBUG 1 --- [           main] o.s.c.t.r.support.SimpleTaskRepository   : Starting: TaskExecution{executionId=23, parentExecutionId=22, exitCode=null, taskName='ctr-a', startTime=Fri Jan 20 12:17:35 UTC 2023, endTime=null, exitMessage='null', externalExecutionId='null', errorMessage='null', arguments=[--management.metrics.tags.service=task-application, --spring.datasource.username=root, --spring.datasource.url=jdbc:postgresql://postgresql:5432/dataflow, --spring.datasource.driverClassName=org.postgresql.Driver, --management.metrics.tags.application=${spring.cloud.task.name:unknown}-${spring.cloud.task.executionid:unknown}, --spring.cloud.task.name=ctr-a, --spring.datasource.password=postgres-root, --spring.cloud.task.parent-execution-id=22, --spring.cloud.task.executionid=23]}
default/ctr-a-q30xnqr0r4[ctr-a-mgy3nlpym5]: 2023-01-20 12:17:35.752  INFO 1 --- [           main] io.spring.timestamp.TaskApplication      : Started TaskApplication in 1.068 seconds (JVM running for 1.231)
default/ctr-a-q30xnqr0r4[ctr-a-mgy3nlpym5]: 2023-01-20 12:17:35.755  INFO 1 --- [           main] io.spring.timestamp.TaskApplication      : 2023-01-20 12:17:35.754
default/ctr-a-q30xnqr0r4[ctr-a-mgy3nlpym5]: 2023-01-20 12:17:35.764 DEBUG 1 --- [           main] o.s.c.t.r.support.SimpleTaskRepository   : Updating: TaskExecution with executionId=23 with the following {exitCode=0, endTime=Fri Jan 20 12:17:35 UTC 2023, exitMessage='null', errorMessage='null'}
default/ctr-a-q30xnqr0r4[ctr-a-mgy3nlpym5]: 2023-01-20 12:17:35.772  INFO 1 --- [ionShutdownHook] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown initiated...
default/ctr-a-q30xnqr0r4[ctr-a-mgy3nlpym5]: 2023-01-20 12:17:35.783  INFO 1 --- [ionShutdownHook] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown completed.
default/ctr-pg4n5m85q4[ctr-wrvzxj6x05]: 2023-01-20 12:17:38.648  INFO 1 --- [           main] .c.d.c.ComposedTaskStepExecutionListener : AfterStep processing for stepExecution ctr-a_0
default/ctr-pg4n5m85q4[ctr-wrvzxj6x05]: 2023-01-20 12:17:38.650  INFO 1 --- [           main] .c.d.c.ComposedTaskStepExecutionListener : AfterStep processing complete for stepExecution ctr-a_0 with taskExecution 23
default/ctr-pg4n5m85q4[ctr-wrvzxj6x05]: 2023-01-20 12:17:38.654  INFO 1 --- [           main] o.s.batch.core.step.AbstractStep         : Step: [ctr-a_0] executed in 6s881ms
default/ctr-pg4n5m85q4[ctr-wrvzxj6x05]: 2023-01-20 12:17:38.664  INFO 1 --- [           main] o.s.batch.core.job.SimpleStepHandler     : Executing step: [ctr-b_0]
default/ctr-b-kg57k4plg0[ctr-b-76ro49d5jm]: 2023-01-20 12:17:42.755  INFO 1 --- [           main] io.spring.timestamp.TaskApplication      : Starting TaskApplication v2.0.2 using Java 1.8.0_352 on ctr-b-kg57k4plg0 with PID 1 (/workspace/BOOT-INF/classes started by cnb in /workspace)
default/ctr-b-kg57k4plg0[ctr-b-76ro49d5jm]: 2023-01-20 12:17:42.757  INFO 1 --- [           main] io.spring.timestamp.TaskApplication      : No active profile set, falling back to 1 default profile: "default"
default/ctr-b-kg57k4plg0[ctr-b-76ro49d5jm]: 2023-01-20 12:17:43.274  INFO 1 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...
default/ctr-b-kg57k4plg0[ctr-b-76ro49d5jm]: 2023-01-20 12:17:43.443  INFO 1 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Start completed.
default/ctr-b-kg57k4plg0[ctr-b-76ro49d5jm]: 2023-01-20 12:17:43.455 DEBUG 1 --- [           main] o.s.c.t.c.SimpleTaskAutoConfiguration    : Using org.springframework.cloud.task.configuration.DefaultTaskConfigurer TaskConfigurer
default/ctr-b-kg57k4plg0[ctr-b-76ro49d5jm]: 2023-01-20 12:17:43.456 DEBUG 1 --- [           main] o.s.c.t.c.DefaultTaskConfigurer          : No EntityManager was found, using DataSourceTransactionManager
default/ctr-b-kg57k4plg0[ctr-b-76ro49d5jm]: 2023-01-20 12:17:43.558 DEBUG 1 --- [           main] o.s.c.t.r.s.TaskRepositoryInitializer    : Initializing task schema for postgresql database
default/ctr-b-kg57k4plg0[ctr-b-76ro49d5jm]: 2023-01-20 12:17:43.630 DEBUG 1 --- [           main] o.s.c.t.r.support.SimpleTaskRepository   : Starting: TaskExecution{executionId=24, parentExecutionId=22, exitCode=null, taskName='ctr-b', startTime=Fri Jan 20 12:17:43 UTC 2023, endTime=null, exitMessage='null', externalExecutionId='null', errorMessage='null', arguments=[--management.metrics.tags.service=task-application, --spring.datasource.username=root, --spring.datasource.url=jdbc:postgresql://postgresql:5432/dataflow, --spring.datasource.driverClassName=org.postgresql.Driver, --management.metrics.tags.application=${spring.cloud.task.name:unknown}-${spring.cloud.task.executionid:unknown}, --spring.cloud.task.name=ctr-b, --spring.datasource.password=postgres-root, --spring.cloud.task.parent-execution-id=22, --spring.cloud.task.executionid=24]}
default/ctr-b-kg57k4plg0[ctr-b-76ro49d5jm]: 2023-01-20 12:17:43.649  INFO 1 --- [           main] io.spring.timestamp.TaskApplication      : Started TaskApplication in 1.114 seconds (JVM running for 1.311)
default/ctr-b-kg57k4plg0[ctr-b-76ro49d5jm]: 2023-01-20 12:17:43.651  INFO 1 --- [           main] io.spring.timestamp.TaskApplication      : 2023-01-20 12:17:43.650
default/ctr-b-kg57k4plg0[ctr-b-76ro49d5jm]: 2023-01-20 12:17:43.657 DEBUG 1 --- [           main] o.s.c.t.r.support.SimpleTaskRepository   : Updating: TaskExecution with executionId=24 with the following {exitCode=0, endTime=Fri Jan 20 12:17:43 UTC 2023, exitMessage='null', errorMessage='null'}
default/ctr-b-kg57k4plg0[ctr-b-76ro49d5jm]: 2023-01-20 12:17:43.664  INFO 1 --- [ionShutdownHook] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown initiated...
default/ctr-b-kg57k4plg0[ctr-b-76ro49d5jm]: 2023-01-20 12:17:43.677  INFO 1 --- [ionShutdownHook] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown completed.
default/ctr-pg4n5m85q4[ctr-wrvzxj6x05]: 2023-01-20 12:17:46.421  INFO 1 --- [           main] .c.d.c.ComposedTaskStepExecutionListener : AfterStep processing for stepExecution ctr-b_0
default/ctr-pg4n5m85q4[ctr-wrvzxj6x05]: 2023-01-20 12:17:46.422  INFO 1 --- [           main] .c.d.c.ComposedTaskStepExecutionListener : AfterStep processing complete for stepExecution ctr-b_0 with taskExecution 24
default/ctr-pg4n5m85q4[ctr-wrvzxj6x05]: 2023-01-20 12:17:46.425  INFO 1 --- [           main] o.s.batch.core.step.AbstractStep         : Step: [ctr-b_0] executed in 7s761ms
default/ctr-pg4n5m85q4[ctr-wrvzxj6x05]: 2023-01-20 12:17:46.433  INFO 1 --- [           main] o.s.b.c.l.support.SimpleJobLauncher      : Job: [FlowJob: [name=ctr]] completed with the following parameters: [{run.id=3}] and the following status: [COMPLETED] in 14s675ms
default/ctr-pg4n5m85q4[ctr-wrvzxj6x05]: 2023-01-20 12:17:46.441  INFO 1 --- [ionShutdownHook] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
default/ctr-pg4n5m85q4[ctr-wrvzxj6x05]: 2023-01-20 12:17:46.443  INFO 1 --- [ionShutdownHook] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown initiated...
default/ctr-pg4n5m85q4[ctr-wrvzxj6x05]: 2023-01-20 12:17:46.445  INFO 1 --- [ionShutdownHook] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown completed.
default/ctr-pg4n5m85q4[ctr-wrvzxj6x05]: 2023-01-20 12:17:46.421  INFO 1 --- [           main] .c.d.c.ComposedTaskStepExecutionListener : AfterStep processing for stepExecution ctr-b_0
default/ctr-pg4n5m85q4[ctr-wrvzxj6x05]: 2023-01-20 12:17:46.422  INFO 1 --- [           main] .c.d.c.ComposedTaskStepExecutionListener : AfterStep processing complete for stepExecution ctr-b_0 with taskExecution 24
default/ctr-pg4n5m85q4[ctr-wrvzxj6x05]: 2023-01-20 12:17:46.425  INFO 1 --- [           main] o.s.batch.core.step.AbstractStep         : Step: [ctr-b_0] executed in 7s761ms
default/ctr-pg4n5m85q4[ctr-wrvzxj6x05]: 2023-01-20 12:17:46.433  INFO 1 --- [           main] o.s.b.c.l.support.SimpleJobLauncher      : Job: [FlowJob: [name=ctr]] completed with the following parameters: [{run.id=3}] and the following status: [COMPLETED] in 14s675ms
default/ctr-pg4n5m85q4[ctr-wrvzxj6x05]: 2023-01-20 12:17:46.441  INFO 1 --- [ionShutdownHook] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'

相关问题