Group Tasks with Subprocesses
With the CI/CD Automation for Simulink Check support package, you can define a development and verification process for your team by using a process model. Within a process, you can use subprocesses to group related tasks, create a hierarchy of tasks, and share parts of your overall process. A subprocess is a self-contained sequence of tasks, inside a process or other subprocess, that can run standalone.
Open Process Model
You can group tasks into subprocesses by editing the process model file for your project. If you do not have a project or process model, see Automate and Run Tasks with Process Advisor to get started.
Open the project that contains your files.
Open Process Advisor. On the Project tab, in the Tools section, click Process Advisor.
Edit the process model by clicking the Edit button in the toolstrip.
Add Tasks to Specific Subprocess
To group the tasks in your process:
In the process model, you can add a subprocess by using
addSubprocess
on your process model object.spA = pm.addSubprocess("Subprocess A");
Instead of adding your tasks directly to your process model object, add your tasks to a specific subprocess by using
addTask
.tA1 = spA.addTask("Task A1"); tA2 = spA.addTask("Task A2");
You can use the
dependsOn
andrunsAfter
methods to define the relationships between tasks and subprocesses in your process.For example, the following process model defines a process in which
Task 1
runs, thenSubprocess A
, and thenSubprocess B
.The build system executes each of the tasks inside a subprocess before existing the subprocess. The following diagram shows a graphical representation of the relationships defined by that process model.function processmodel(pm) % Defines the project's processmodel arguments pm padv.ProcessModel end t1 = pm.addTask("Task 1"); spA = pm.addSubprocess("Subprocess A"); tA1 = spA.addTask("Task A1"); tA2 = spA.addTask("Task A2"); spB = pm.addSubprocess("Subprocess B"); tB1 = spB.addTask("Task B1"); tB2 = spB.addTask("Task B2"); % Relationships spA.dependsOn(t1); tA2.dependsOn(tA1); spB.dependsOn(spA); tB2.dependsOn(tB1); end
Considerations for Subprocess Boundaries
The relationships that you specify in the process model cannot cross
any subprocess boundaries. For example, in the
previous process model, you cannot directly specify that Task
A1
depends on Task 1
because that relationship
would enter into Subprocess A
, crossing the subprocess
boundary.
In this case, you need to create a relationship between the Task
1
and Subprocess A
instead.
Example Process Model with Subprocesses
To access an example process model that groups tasks into subprocesses for
Model Verification and Code
Verification, enter
processAdvisorExampleStart(Subprocess = true)
at the
command line.