Main Content

createProcessTaskID

Generate ID for specific task iteration defined by process model

    Description

    ID = createProcessTaskID(task,artifact) generates the identifier, ID, for an individual task iteration defined by the process model. A task iteration is the pairing of a task, task, to a specific project artifact, artifact.

    This function requires CI/CD Automation for Simulink Check.

    example

    Examples

    collapse all

    Suppose you have a process model with several tasks, but right now you only want to run the task padv.builtin.task.RunModelStandards on the model AHRS_Voter.slx. Use the function createProcessTaskID to generate the ID for a specific task iteration, then use the function runprocess to run only that specific task iteration.

    Open the Process Advisor example project, which contains an example process model.

    processAdvisorExampleStart

    Specify a task that exists in the process model. For this example, specify the built-in task for running Model Advisor checks, padv.builtin.task.RunModelStandards.

    task = padv.builtin.task.RunModelStandards;

    Use padv.Artifact to specify the project artifact that you want the task to run on. For this example, the artifact type is sl_model_file because the artifact is a Simulink® model and the address is the path to AHRS_Voter.slx, relative to the project root.

    artifactType = "sl_model_file";
    address = fullfile("02_Models","AHRS_Voter","specification","AHRS_Voter.slx");
    artifact = padv.Artifact(artifactType,address);

    Use the task instance and artifact to generate the ID for the specific task iteration.

    runModelStandards_for_AHRS_Voter = createProcessTaskID(task,artifact)
    runModelStandards_for_AHRS_Voter = 
    
    "padv.builtin.task.RunModelStandards|sl_model_file|02_Models/AHRS_Voter/specification/AHRS_Voter.slx"

    Use the function runprocess to run the task iteration.

    runprocess(Tasks = runModelStandards_for_AHRS_Voter)
    When you specify the Tasks value as the ID for a single task iteration, the function runprocess runs only the specified task iteration. For this example, runprocess runs only the task iteration associated with the task padv.builtin.task.RunModelStandards and the artifact AHRS_Voter.slx.

    Note

    Alternatively, instead of creating and then running the task iterations, you can directly specify the Task and FilterArtifact arguments of the runprocess function to run the task on a specific artifact:

    runprocess(...
    Tasks = "padv.builtin.task.RunModelStandards",...
    FilterArtifact = fullfile("02_Models","AHRS_Voter","specification","AHRS_Voter.slx"))
    But note that you can only run the tasks if the tasks are defined in the process model and the artifacts exist in the project.

    Input Arguments

    collapse all

    Either:

    • Name of task, specified as a string or character vector. The name of a task is stored in the Name property of the task. For example, "name_of_my_custom_task".

    • Subclass of padv.Task, specified as a padv.Task object. Built-in tasks are subclasses of padv.Task. For example, you can specify the padv.Task object padv.builtin.task.RunModelStandards for the task argument.

    Example: "name_of_my_custom_task"

    Example: "padv.builtin.task.RunModelStandards"

    Example: padv.builtin.task.RunModelStandards

    Data Types: char | string

    File in project, specified as a padv.Artifact object.

    Example: padv.Artifact("project","ProcessAdvisorExample.prj")

    Example: padv.Artifact("sl_model_file", "02_Models/AHRS_Voter/specification/AHRS_Voter.slx")

    Output Arguments

    collapse all

    Identifier for task iteration defined by the process model, returned as a string.

    IDs take the form: "taskNameOrObject|fileType|relativePath", where relativePath is the path relative to the project root.

    Example IDs:

    • "myCustomProjectTask|project|ProcessAdvisorExample.prj"

    • "padv.builtin.task.RunModelStandards|sl_model_file|02_Models/AHRS_Voter/specification/AHRS_Voter.slx"

    • "padv.builtin.task.RunTestsPerTestCase|sl_test_case|ced877ff-cfb8-4fa8-9bbf-aaa29b1d926b"

    Alternative Functionality

    App

    You can also use the Process Advisor app to run individual task iterations in the process. To open the Process Advisor app for a project, in the MATLAB® Command Window, enter:

    processAdvisorWindow