Main Content

padv.buildtool.tasks.RunProcessTask Class

Namespace: padv.buildtool.tasks
Superclasses: matlab.buildtool.Task

Task for running Process Advisor process

Since R2023a

Description

The padv.buildtool.tasks.RunProcessTask class provides a MATLAB® build task for running a Process Advisor process. The task requires the CI/CD Automation for Simulink Check support package.

Tasks that you create with the RunProcessTask class use Process Advisor to manage incremental builds. When you rerun a build containing a RunProcessTask instance, the MATLAB build tool invokes the runprocess function, which then decides whether to rerun or skip tasks in the process. For more information, see IncrementalBuild.

Creation

Description

task = padv.buildtool.tasks.RunProcessTask creates a task for running the default process in the process model. The task fails if the process run errors or fails.

example

task = padv.buildtool.tasks.RunProcessTask(process) creates a task for running the specified process in the process model.

task = padv.buildtool.tasks.RunProcessTask(___,Name=Value) sets writable properties using one or more name-value arguments in addition to any of the input argument combinations in previous syntaxes. You can also set the Description and Dependencies properties, which the class inherits from the Task class, using name-value arguments. For example, task = padv.buildtool.tasks.RunProcessTask(GenerateReport=true) creates a task that generates a Process Advisor report.

Input Arguments

expand all

Process to run, specified as a string scalar or character vector.

This argument sets the Process property.

Properties

expand all

In addition to these properties, the RunProcessTask class inherits properties from the Task class. Of the inherited properties, you can set the Description and Dependencies properties using name-value arguments during task creation.

Process to run, specified as a string scalar or character vector. By default, the task runs the default process in the process model.

Attributes:

GetAccess
public
SetAccess
public

Subprocesses to run, specified as a string vector, character vector, or cell vector of character vectors.

Attributes:

GetAccess
public
SetAccess
public

Tasks to run, specified as a string vector, character vector, or cell vector of character vectors.

Attributes:

GetAccess
public
SetAccess
public

Artifacts to run tasks for, specified as either the:

  • Full path to an artifact

  • Relative path to an artifact

  • padv.Artifact object that represents an artifact

  • array of padv.Artifact objects

Attributes:

GetAccess
public
SetAccess
public

Option to a generate report, specified as a numeric or logical 1 (true) or 0 (false). By default, the task does not generate a report.

Attributes:

GetAccess
public
SetAccess
public

Generated report format, specified as one of these values:

  • "pdf" — PDF file

  • "html" — HTML report, packaged as a zipped file that contains the HTML file, images, style sheet, and JavaScript® files of the report

  • "html-file" — HTML report

  • "docx"Microsoft® Word document

To generate a report, you must specify the GenerateReport property as true (1). By default, the task generates a report in PDF format.

Attributes:

GetAccess
public
SetAccess
public

Generated report path, specified as a string scalar or character vector.

To generate a report, you must specify the GenerateReport property as true (1). By default, the task generates a report named "ProcessAdvisorReport" in the current working directory.

Attributes:

GetAccess
public
SetAccess
public

Examples

collapse all

Run the tasks in your Process Advisor process by using the RunProcessTask class. You must have a Simulink® Check™ license and you must have the CI/CD Automation for Simulink Check installed on your system to run this example.

Open the Process Advisor example project.

processAdvisorExampleStart

The model AHRS_Voter opens with the Process Advisor pane to the left of the Simulink canvas. The project contains an example process model with Process Advisor tasks that can perform common activities such as collecting model maintainability metrics for a model in your project. For more information about Process Advisor and the process model, see Automate and Run Tasks with Process Advisor.

In the project root folder, create a new build file, buildfile.m, that contains the following code. This build file has a task, RunProcessTask, that collects model maintainability metrics for the AHRS_Voter model by using the Process Advisor task CollectMetrics.

function plan = buildfile
import padv.buildtool.tasks.RunProcessTask

% Create a plan with no tasks
plan = buildplan;

% Add a task to run Process Advisor
plan("runprocess") = RunProcessTask(...
    Tasks="padv.builtin.task.CollectMetrics",...
    FilterArtifact=fullfile("02_Models","AHRS_Voter","specification","AHRS_Voter.slx"));

Run the "runprocess" task. The task collects the metrics and saves a model maintainability report, AHRS_Voter_ModelMaintainability.pdf. In this example, the task runs successfully.

buildtool runprocess
** Starting runprocess
#####################
## Starting Process Advisor build at 22-Nov-2024 12:17:34
#### requireDependencies: 1
#### force:               0
#### Tasks to run:
####      padv.builtin.task.CollectMetrics::02_Models/AHRS_Voter/specification/AHRS_Voter.slx
#####################
## Starting task padv.builtin.task.CollectMetrics::02_Models/AHRS_Voter/specification/AHRS_Voter.slx
## Task: Collect Model Maintainability Metrics
#### Input Artifacts:
####      02_Models/AHRS_Voter/specification/AHRS_Voter.slx
#### Dependent Artifacts:
####      02_Models/AHRS_Voter/specification/data/DD_AHRS_Voter.sldd
####      02_Models/common/specification/data/csSingleInstance.sldd
####      02_Models/common/specification/data_types/bus_types.sldd
####      processmodel.m
#### Output Artifacts:
####      04_Results/AHRS_Voter/metrics/AHRS_Voter_ModelMaintainability.pdf
#### Pass:        1
#### Warn:        0
#### Fail:        0
#### Start:       22-Nov-2024 12:17:34
#### End:         22-Nov-2024 12:17:43
#### Duration:    00:00:08
#### Task Status: Pass
## Completed task padv.builtin.task.CollectMetrics::02_Models/AHRS_Voter/specification/AHRS_Voter.slx
#####################
#####################
## Ending Process Advisor build at 22-Nov-2024 12:17:43
#### Duration:                  00:00:09
## Build Status:              22-Nov-2024 12:17:43
#### Number of tasks:           1
#### Number of tasks executed:  1
#### Number of tasks skipped:   0
#### Number of tasks in queue:  0
#### Number of tasks failed:    0
#####################
** Finished runprocess

In Process Advisor, in the Tasks column, the task status next to left of Collect Model Maintainability Metrics shows that the task passed for the AHRS_Voter model.

If you rerun the "runprocess" task, Process Advisor automatically skips the task because the task results are already up to date and the inputs and dependencies did not change.

buildtool runprocess
** Starting runprocess
#####################
## Starting Process Advisor build at 22-Nov-2024 12:36:03
#### requireDependencies: 1
#### force:               0
#### Tasks to run:
####      padv.builtin.task.CollectMetrics::02_Models/AHRS_Voter/specification/AHRS_Voter.slx
#####################
#### Skipping task padv.builtin.task.CollectMetrics
####      Iteration Artifact:  02_Models/AHRS_Voter/specification/AHRS_Voter.slx
####      Task Up-to-date: 1
####      Task State:      Executed
#####################
#####################
## Ending Process Advisor build at 22-Nov-2024 12:36:03
#### Duration:                  00:00:00
## Build Status:              22-Nov-2024 12:36:03
#### Number of tasks:           1
#### Number of tasks executed:  0
#### Number of tasks skipped:   1
#### Number of tasks in queue:  0
#### Number of tasks failed:    0
#### Tasks that were skipped:(Status::Task::IterationArtifact)
####      Pass::padv.builtin.task.CollectMetrics::02_Models/AHRS_Voter/specification/AHRS_Voter.slx
#####################
** Finished runprocess

More About

expand all

Version History

Introduced in R2023a