Main Content

padv.Process Class

Namespace: padv

Group tasks and subprocesses in process model

Description

This class requires CI/CD Automation for Simulink Check.

A padv.Process object represents a group of tasks and subprocesses in your process model. By default, if you do not add processes to your process model, your process model has a default process "CIPipeline". To create other processes in your process model, create a new process object by using the method addProcess. You can group tasks and other subprocesses inside a specified process by using addTask and addSubprocess. You can specify a dependency or desired execution order between tasks and subprocesses inside your process by using either addDependsOnRelationship or addRunsAfterRelationship. For more information, see Manage Multiple Build and Verification Workflows Using Processes.

The padv.Process class is a handle class.

Class Attributes

Sealed
true

For information on class attributes, see Class Attributes.

Creation

Description

process = padv.Process(Name) represents a process, named Name, inside a process model. Each process in the process model must have a unique Name.

example

process = padv.Process(___,Name=Value) sets properties using one or more name-value arguments. For example, padv.Process("myProcess",Title="My Process") creates a process with the title My Process in Process Advisor.

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.

Properties

expand all

Path to process documentation, returned as a string.

Example: fullfile(pwd,"myHelpFiles","myProcessDocumentation.pdf")

Data Types: string

Process description, returned as a string.

Example: "This is my process."

Data Types: string

Instructions to help you fix issues in assessment results, specified as a string.

The string must represent a file path with one of these valid file extensions:

  • .md — Markdown file

  • .bin — Binary file

You can create and manage formal assessments of your task inputs and outputs by using padv.Assessment and padv.AssessmentResult objects.

Example: "instructions.md"

Data Types: string

Unique identifier for the process, returned as a string. When you specify the Name, you specify the Name property of the process object.

Each process in the process model must have a unique Name.

Example: "myProcess"

Data Types: string

Tools to help complete activities for tasks, returned as a padv.TaskTool object or an array of padv.TaskTool objects. For information on how to create task tools, see padv.TaskTool.

When you specify this property, you must also add the task tools to your process model by using addTaskTool.

Example: padv.TaskTool(ToolFunction="app1_exported",Title="My App",Type=padv.TaskToolType.TaskApp)

Human readable name that appears in the Processes drop-down menu in the Process Advisor app, returned as a string. By default, the Process Advisor app uses the Name property of the process as the Title.

Example: "My Process"

Data Types: string

Methods

expand all

Examples

collapse all

You can use addProcess to create a new process and add that process to the process model. addProcess returns a padv.Process object that can represent a group of tasks and subprocesses in a process model.

For example, this process model creates a new process, ProcessA, adds tasks to the process, and adds a dependency between those tasks.

function processmodel(pm)
    % Defines the project's processmodel

    arguments
        pm padv.ProcessModel
    end

    % Create and add process to process model
    processA = pm.addProcess("ProcessA");

    % Add tasks to Process A
    taskA = processA.addTask("taskA");
    taskB = processA.addTask("taskB");

    % Add dependency between tasks inside Process A
    processA.addDependsOnRelationship(...
        Source = taskB,...
        Dependency = taskA);
    
end

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 and processB

  • Adds example tasks and subprocess to the processes by using the addTask and addSubprocess methods

  • Defines task relationships inside a specific process by using the addDependsOnRelationship and addRunsAfterRelationship 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.

Process Advisor Tasks column showing mouse pointing to taskA2