Main Content

padv.builtin.query.GetOutputsOfDependentTask Class

Namespace: padv.builtin.query
Superclasses: padv.Query

Query for getting outputs from predecessor task

Description

This class requires CI/CD Automation for Simulink Check.

The padv.builtin.query.GetOutputsOfDependentTask class provides a query that can return the outputs from a predecessor task.

You can use this query in your process model or task definition to find artifacts for your task to use as inputs. Typically, you use this query to pass the outputs of one task as inputs to another task. For example, if TaskB depends on TaskA, then TaskA is a predecessor task. You can pass the outputs from TaskA to TaskB by specifying GetOutputsOfDependentTask as an input query for TaskB.

The padv.builtin.query.GetOutputsOfDependentTask class is a handle class.

Creation

Input Arguments

expand 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: padv.builtin.query.GetOutputsOfDependentTask(Name="MyQuery",Task="TaskA")

Task name or instance, specified as a string or padv.Task object.

This argument specifies the value of the DependentTask property for the class instance.

Example: "NameOfMyTask"

Example: padv.builtin.task.RunModelStandards

Name of query, specified as a string.

This argument specifies the value of the Name property for the class instance.

Example: "NameOfMyQuery"

Properties

expand all

Predecessor task name or instance, specified as a string or padv.Task object.

Example: "NameOfMyTask"

Example: padv.builtin.task.RunModelStandards

Data Types: string

Query title, specified as a string or a character vector.

Example: "Get artifacts from previous task"

Data Types: char | string

Initial query that runs before iteration query, specified as either a padv.Query object or the Name of a padv.Query object. When you specify an iteration query for a task, the parent query is the initial query that the build system runs before running the specified iteration query.

For information on how to improve Process Advisor load times by sharing query instances across your process model, see Best Practices for Process Model Authoring.

Example: sharedQuery

Example: "FindMyInitialArtifacts"

Unique identifier for query, specified as a string.

Example: "GetOutputsFromTask"

Data Types: string

Show file extensions in the Alias property of returned artifacts, specified as a numeric or logical 1 (true) or 0 (false). The Alias property controls the display name for the artifact in the Tasks column in Process Advisor.

By default, queries strip file extensions from the Alias property of each task iteration artifact. To show file extensions for all artifacts in the Tasks column, select the project setting Show file extensions. To keep file extensions in the results for a specific query, specify the query property ShowFileExtension as true.

Example: true

Data Types: logical

Setting for automatically sorting artifacts by address, specified as a numeric or logical 1 (true) or 0 (false). When a query returns artifacts, the artifacts should be in a consistent order. By default, the build system sorts artifacts by the artifact address.

Alternatively, you can sort artifacts in a different order by overriding the internal sortArtifacts method in a subclass that defines a custom sort behavior. For an example, see Sort Artifacts in Specific Order.

The build system automatically calls the sortArtifacts method when using the process model. The sortArtifacts method expects two input arguments: a padv.Query object and a list of padv.Artifact objects returned by the run method. The sortArtifacts method should return a list of sorted padv.Artifact objects.

Example: SortArtifacts = false

Data Types: logical

Handle to the function that a function-based query runs, specified as a function_handle.

If you define your query functionality inside a function and you or the build system call run on the query, the query runs the function specified by the function_handle.

The built-in queries are defined inside classes and do not use the FunctionHandle.

Example: FunctionHandle = @FunctionForQuery

Data Types: function_handle

Methods

expand all

Examples

collapse all

Suppose that you want to pass the output of one task as the input to another task. You can use the built-in query GetOutputsOfDependentTask to find the outputs of the predecessor task and specify that query as an input query for the task.

For this example, open the Process Advisor example project.

processAdvisorExampleStart

The process model for the example specifies that the Merge Test Results task depends on the Run Tests task:

if includeTestsPerTestCaseTask && includeMergeTestResultsTask
    mergeTestTask.dependsOn(milTask, "WhenStatus",{'Pass','Fail'});
end

If you open the source code for the Merge Test Results task, you can see that the task uses the built-in query padv.builtin.query.GetOutputsOfDependentTask as an input query.

open padv.builtin.task.MergeTestResults
...
options.InputQueries = [padv.builtin.query.GetIterationArtifact,...
    padv.builtin.query.GetOutputsOfDependentTask(...
    Task="padv.builtin.task.RunTestsPerTestCase")];
options.InputDependencyQuery = padv.builtin.query.GetDependentArtifacts;
...

When you run the Merge Test Results task, the build system runs this input query, which passes the current model and the outputs of the Run Tests task as inputs to the Merge Test Results task.

For each input, the build system checks for other artifacts that the inputs depend on by running the InputDependencyQuery. For the Merge Test Results task, the input dependency query allows the build system to find related artifacts, such as data dictionaries, that the model uses. Those dependencies can impact if the task results are up-to-date or outdated.

Capabilities and Limitations

This table identifies functionality that is supported by the query.

FunctionalitySupported?

Input query for task

Yes.

Iteration query for task

No.