Main Content

padv.TaskContext Class

Namespace: padv

Access additional information about task execution context

Description

This class requires CI/CD Automation for Simulink Check.

A padv.TaskContext object represents information about the execution context of a task. The running tasks and task tools use instances of padv.TaskContext to represent information about a task and the process in which that task runs. You can use the class methods to get the process name, iteration artifact name, and other information related to a task in a process.

The build system instantiates this class and the running tasks and task tools have access to this information. You do not need to create an object of the class directly.

The padv.TaskContext class is a handle class.

Methods

expand all

Examples

collapse all

To get additional information about the execution context of a task, you can use the padv.TaskContext methods. For example, if you have a custom task and you override the default openArtifact method behavior for the task, you can use the task context to get process, model, and task ID information.

In the method signature, taskContext is represented by a padv.TaskContext object that is available to the task.

function status = openArtifact(obj,artifact,taskContext)
    % Override default openArtifact method

    % Validate input arguments
    arguments
        obj
        artifact (1,1) padv.Artifact {mustBeNonempty}
        taskContext (1,1) padv.TaskContext
    end

    % Get process, model, and task ID information
    processName = taskContext.getProcessName()
    modelArtifact = taskContext.getIterationArtifact()
    taskID = taskContext.getTaskId()

    ...

    status = true;

end
Go to top of page