如果有多个任务可用,SSIS如何决定下一个要执行的任务

时间:2022-09-17 02:16:47

For example if I add four (blank) script tasks A1, A2, B1, and B2, where A2 has a constraint to run after A1 and B2 has a constraint to run after B1, but neither A1 nor B1 have constraints, then what order will the tasks run?

例如,如果我添加四个(空白)脚本任务A1,A2,B1和B2,其中A2有一个约束要在A1之后运行并且B2有一个约束要在B1之后运行,但A1和B1都没有约束,那么是什么顺序任务会运行吗?

When I try this it seems to do A1, then B1, then A2, then B2. But why? This question out of curiosity.

当我尝试这个时,它似乎做A1,然后是B1,然后是A2,然后是B2。但为什么?这个问题出于好奇。


Edited to add:

编辑添加:

I've specifically set parallelism to 1 and added message boxes so I can see the order it's taking. It always takes the same order that I note above, but was curious as to if there was any logic as to why it chooses this order.

我特意将并行性设置为1并添加了消息框,以便我可以看到它所采用的顺序。它总是采用我上面提到的相同顺序,但是对于为什么选择这个顺序有任何逻辑感到好奇。


It seems to do all the level one (unconstrained) tasks first then continue with constrained tasks.

它似乎首先执行所有一级(无约束)任务,然后继续执行约束任务。

2 个解决方案

#1


The package is stored as an XML .dtsx file. Without constraints, the objects will execute in the order they appear in the file.

该包存储为XML .dtsx文件。没有约束,对象将按它们在文件中出现的顺序执行。

#2


I always see things like this run in parallel.

我总是看到这样的东西并行运行。

So A1 and A2 will run and then B1 will start as soon as A1 is done and B2 will start as soon as B1 is done.

因此A1和A2将运行,然后B1将在A1完成后立即启动,B2将在B1完成后立即启动。

Unless you explicitly put a constraint, there's nothing to stop both from running at the same time. If your script tasks are really short or you've limited the parallelism, perhaps it will run them in sequence, but I'm sure the sequence chosen is not guaranteed.

除非你明确地设置了约束,否则没有什么可以阻止它们同时运行。如果您的脚本任务非常短或者您限制了并行性,也许它会按顺序运行它们,但我确信所选择的序列不能保证。

#1


The package is stored as an XML .dtsx file. Without constraints, the objects will execute in the order they appear in the file.

该包存储为XML .dtsx文件。没有约束,对象将按它们在文件中出现的顺序执行。

#2


I always see things like this run in parallel.

我总是看到这样的东西并行运行。

So A1 and A2 will run and then B1 will start as soon as A1 is done and B2 will start as soon as B1 is done.

因此A1和A2将运行,然后B1将在A1完成后立即启动,B2将在B1完成后立即启动。

Unless you explicitly put a constraint, there's nothing to stop both from running at the same time. If your script tasks are really short or you've limited the parallelism, perhaps it will run them in sequence, but I'm sure the sequence chosen is not guaranteed.

除非你明确地设置了约束,否则没有什么可以阻止它们同时运行。如果您的脚本任务非常短或者您限制了并行性,也许它会按顺序运行它们,但我确信所选择的序列不能保证。