Main Content

getProcessTaskResults

Get available task results and result details for task iterations in MBD pipeline

    Description

    [IDsWithTaskResults,taskResults,taskResultsOutdated] = getProcessTaskResults() returns available task results and result details for the task iterations in the MBD pipeline. The function returns the identifiers for task iterations that have task results, IDsWithTaskResults, the current task results, taskResults, and a logical value that indicates if the task results are outdated, taskResultsOutdated.

    If you do not have task results, use the function runprocess to run tasks and generate results. The function getProcessTaskResults only returns information related to task iterations that are defined in the process model. If you have task results from a task iteration that is not in the process model, the function does not return information related to those task results.

    This function requires CI/CD Automation for Simulink Check.

    example

    [IDsWithTaskResults,taskResults,taskResultsOutdated] = getProcessTaskResults(Name=Value) specifies options using one or more name-value arguments.

    example

    Examples

    collapse all

    Get the available task results for a task iteration and use the result details to find information about the output artifacts of the task iteration.

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

    processAdvisorExampleStart

    List the IDs for each task iteration in the MBD pipeline.

    IDs = generateProcessTasks();

    Run the first task iteration in the list.

    runprocess(Tasks=IDs(1))
    For this example, the build system runs the task padv.builtin.task.GenerateSimulinkWebView for the model AHRS_Voter.slx.

    Get the available task results and result details.

    [IDsWithResults,results,outdated] = getProcessTaskResults()
    IDsWithResults = 
    
        "padv.builtin.task.GenerateSimulinkWebView|sl_model_file|02_Models/AHRS_Voter/specification/AHRS_Voter.slx"
    
    
    results = 
    
      TaskResult with properties:
    
                 Status: Pass
        OutputArtifacts: [1×1 padv.Artifact]
                Details: [1×1 struct]
                 Values: [1×1 struct]
           ResultValues: [1×1 struct]
    
    
    outdated =
    
      logical
    
       0

    Get the output artifacts from the result. For this example, the result is a Simulink® Web View for the model AHRS_Voter.slx.

    webView = results.OutputArtifacts
    webView = 
    
      Artifact with properties:
    
                   Type: "padv_output_file"
                 Parent: [0×0 padv.Artifact]
        ArtifactAddress: [1×1 padv.util.ArtifactAddress]
                  Alias: ""

    Get the available task results for a specific model.

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

    processAdvisorExampleStart

    Check modeling standards for the model AHRS_Voter.slx by using the built-in task padv.builtin.task.RunModelStandards. The task uses Model Advisor to run checks on the model.

    runprocess(...
    Tasks = "padv.builtin.task.RunModelStandards",...
    FilterArtifact = fullfile("02_Models","AHRS_Voter","specification","AHRS_Voter.slx"));

    Get the task results and result details.

    [IDsWithResults,results,outdated] = getProcessTaskResults(...
    Tasks = "padv.builtin.task.RunModelStandards",...
    FilterArtifact = fullfile("02_Models","AHRS_Voter","specification","AHRS_Voter.slx"))
    IDsWithResults = 
    
        "padv.builtin.task.RunModelStandards|sl_model_file|ProcessAdvisorExample|02_Models/AHRS_Voter/specification/AHRS_Voter.slx"
    
    
    results = 
    
      TaskResult with properties:
    
                 Status: Pass
        OutputArtifacts: [1×1 padv.Artifact]
                Details: [1×1 struct]
                 Values: [1×1 struct]
           ResultValues: [1×1 struct]
    
    
    outdated =
    
      logical
    
       0

    Input Arguments

    collapse all

    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: [~,results,~] = getProcessTaskResults(Tasks="maTask", FilterArtifact=fullfile("models","myModel.slx"));

    Names of tasks that you want to run, specified as a character vector, cell array of character vectors, string, or string array. The task name is defined by the Name property of the task.

    Alternatively, you can specify the task iteration IDs for individual task iterations that you want to run. See generateProcessTasks and createProcessTaskID.

    Note

    You can only run tasks that are defined in the process model.

    Example: "padv.builtin.task.GenerateSimulinkWebView"

    Example: ["padv.builtin.task.GenerateSimulinkWebView",... "padv.builtin.task.RunModelStandards"]

    Data Types: char | string

    Name of process that you want to run, specified by a character vector or string.

    Example: "CIPipeline"

    Data Types: char | string

    Names of subprocesses that you want to run, specified as a character vector, cell array of character vectors, string, or string array. The subprocess name is defined by the Name property of the subprocess.

    Example: "SubprocessA"

    Example: ["SubprocessA",SubprocessB"]

    Data Types: char | string

    Artifact or artifacts that you want to run tasks for, specified as either the full path to an artifact, relative path to an artifact, a padv.Artifact object that represents an artifact, or an array of padv.Artifact objects.

    Example: fullfile("C:\","User","projectA","myModel.slx")

    Example: fullfile("02_Models","AHRS_Voter","specification","AHRS_Voter.slx")

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

    Data Types: string

    Output Arguments

    collapse all

    Identifiers for task iterations that have task results and are defined in the process model, returned as a string or string array.

    • If you do not have task results for task iterations in your process model, IDsWithTaskResults returns an empty array, []. You can use the function runprocess to run tasks and generate results.

    • If you have task results for task iterations that are not in your process model, IDsWithTaskResults returns an empty array, [].

    • If you have task results for task iterations that are in your process model, IDsWithTaskResults returns the IDs for the task iterations that have task results.

    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"

    Results for task iterations, returned as a padv.TaskResult or padv.TaskResult array.

    • If you do not have task results for task iterations in your process model, taskResults returns an empty array, [].

    • If you have task results for task iterations that are not in your process model, taskResults returns an empty array, [].

    • If you have task results for task iterations that are in your process model, taskResults returns a padv.TaskResult or padv.TaskResult array.

    padv.TaskResult objects contain properties for the result status, output artifacts, details, and result values for the number of passing, warning, and failing results for task iterations.

    Status of task results, returned as a logical value or logical array. Values of 1 indicate that the results for the task iteration are outdated and might not reflect the current state of the project or task. Values of 0 indicate that the results for the task iteration are up-to-date. The result is an empty array, [], when there are not task results.