addRunsAfterRelationship
Class: padv.Process
Namespace: padv
Specify predecessor for task or subprocess
Syntax
addRunsAfterRelationship(process,Source=sourceTaskOrSubprocess,Predecessor=predecessorTaskOrSubprocess)
addRunsAfterRelationship(___,Name=Value)
Description
addRunsAfterRelationship(
specifies that in the process
,Source=sourceTaskOrSubprocess
,Predecessor=predecessorTaskOrSubprocess
)process
, the source should run after the
predecessor.
addRunsAfterRelationship(___,
specifies additional characteristics of the relationship by using one or more
Name=Value
)Name=Value
arguments. For example,
addRunsAfterRelationship(p1,Source=t2,Predecessor=t1,Override=true)
specifies that in process p1
, task t2
should run after
task t1
and that this relationship overrides
any other relationships defined between tasks
t1
and t2
in the process.
Input Arguments
process
— Process
padv.Process
object
Process, specified as a padv.Process
object.
Example: padv.Process("p1")
sourceTaskOrSubprocess
— Task or subprocess that should run after completion of predecessor task or subprocess
string | padv.Task
object | padv.Subprocess
Task or subprocess that should run after completion of predecessor task or subprocess, specified as either:
Task name, specified as a string
Task instance, specified as a
padv.Task
objectSubprocess name, specified as a string
Subprocess instance, specified as a
padv.Subprocess
object
Example: "TaskB"
Example: padv.Task("TaskB")
Example: padv.builtin.task.GenerateCode()
predecessorTaskOrSubprocess
— Task or subprocess that should run before source task or subprocess
string | padv.Task
object | padv.Subprocess
Task or subprocess that should run before source task or subprocess, specified as either:
Task name, specified as a string
Task instance, specified as a
padv.Task
objectSubprocess name, specified as a string
Subprocess instance, specified as a
padv.Subprocess
object
Example: "TaskA"
Example: padv.Task("TaskA")
Example: padv.builtin.task.RunModelStandards()
Name-Value Arguments
Specify optional pairs of arguments as
Name1=Value1,...,NameN=ValueN
, where Name
is
the argument name and Value
is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.
Example: addRunsAfterRelationship(p1,Source=t2,Predecessor=t1,Override=true)
IterationArtifactMatching
— Option to control which predecessor task iterations run
true
or 1
(default) | false
or 0
Option to control which predecessor task iterations run, specified as a numeric or
logical 1
(true
) or 0
(false
):
true
— When the build system runs the predecessors, the build system runs only the task iterations that the tasks or subprocesses have in common.false
— When the build system runs the predecessors, the build system runs all task iterations. This behavior is useful when you have a task that creates new project artifacts and a task that runs on each artifact in the project. The second task should run after all project artifacts are generated by the first task.
For example, suppose you have two tasks: FirstTask
and
SecondTask
:
FirstTask
runs onModelA
andModelB
.SecondTask
runs only onModelB
and should run after onFirstTask
.
If you run SecondTask
and:
IterationArtifactMatching
istrue
,FirstTask
runs only onModelB
.IterationArtifactMatching
isfalse
,FirstTask
runs on bothModelA
andModelB
.
Data Types: logical
Override
— Replace existing relationship
false
or 0
(default) | true
or 1
Replace existing relationship, specified as a numeric or logical
0
(false
) or 1
(true
).
By default, if you define multiple relationships between the same tasks or
subprocesses, the build system only uses the most recent relationship and ignores
previous relationships. Setting the Override
argument as
1
(true
) makes sure that the current
relationship replaces any existing
relationships.
Data Types: logical
StrictOrdering
— Option to control whether build system ignores circular relationships between tasks or subprocesses
false
or 0
(default) | true
or 1
Option to control whether the build system ignores circular relationships between
tasks or subprocesses, specified as a numeric or logical 0
(false
) or 1
(true
).
By default, if you specify a circular relationship between tasks or subprocesses,
the build system ignores the relationship. For example, if you specify both
addRunsAfterRelationship(p1,SecondTask,FirstTask)
and
addRunsAfterRelationship(p1,FirstTask,SecondTask)
, the build
system ignores the addRunsAfterRelationship
relationship.
If you specify StrictOrdering
as true
, the
build system generates an error when you try to run tasks or subprocesses that have a
circular relationship.
Data Types: logical
Examples
Add Tasks and Subprocesses Inside Process
In your process model, you can define multiple processes for
different workflows and environments. A process consists of the tasks and subprocesses
that you add to your padv.Process
process by using the
addTask
and addSubprocess
methods. To specify the
relationships between tasks inside a specific process, use the
addDependsOnRelationship
and addRunsAfterRelationship
methods.
Open the Process Advisor example project.
processAdvisorExampleStart
The model AHRS_Voter
opens with the Process Advisor pane to the left of the Simulink® canvas.
In the Process Advisor pane, click the Edit process model button to open the
processmodel.m
file for the project.
Replace the contents of the processmodel.m
file with the following example code. The code:
Defines two processes,
processA
andprocessB
Adds example tasks and subprocess to the processes by using the
addTask
andaddSubprocess
methodsDefines task relationships inside a specific process by using the
addDependsOnRelationship
andaddRunsAfterRelationship
methods
function processmodel(pm) % This function defines a process model for a project by setting up processes, % subprocesses, and tasks within those processes. arguments pm padv.ProcessModel end % --- Processes --- % Add processes to process model processA = pm.addProcess("A"); processB = pm.addProcess("B"); % --- Tasks --- % Create example tasks task1 = padv.Task("task1"); task2 = padv.Task("task2"); task3 = padv.Task("task3"); taskA1 = padv.Task("taskA1"); taskA2 = padv.Task("taskA2"); taskB1 = padv.Task("taskB1"); taskB2 = padv.Task("taskB2"); % --- Subprocesses --- % Add subprocesses to parent process subprocessA = processA.addSubprocess("subprocessA"); % Add to process A subprocessB = processB.addSubprocess("subprocessB"); % Add to process B % --- Add Tasks to Processes --- processA.addTask(task1); % Add task1 to process A processA.addTask(task2); % Add task2 to process A processB.addTask(task1); % Reuse task1 in process B processB.addTask(task3); % Add task3 to process B % --- Add Tasks to Subprocesses --- subprocessA.addTask(taskA1); % Add taskA1 to subprocessA under process A subprocessA.addTask(taskA2); % Add taskA2 to subprocessA under process A subprocessB.addTask(taskB1); % Add taskB1 to subprocessB under process B subprocessB.addTask(taskB2); % Add taskB2 to subprocessB under process B % --- Add Relationships Between Tasks --- % In processA, task2 should run after task1 processA.addRunsAfterRelationship(... Source = task2,... Predecessor = task1); % In processA, taskA2 depends on taskA1 processA.addDependsOnRelationship(... Source = taskA2,... Dependency = taskA1); end
In Process Advisor, refresh by clicking Refresh Tasks.
You can select which process you want to use from the Process gallery in the toolstrip. By default, processes appear in the order that you define them in the process model.
If you point to the run button for taskA2
in process A, Process Advisor highlights the dependency between taskA2
and taskA1
.
See Also
Functions
Classes
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: United States.
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)