|
1 | 1 | import os |
2 | | -import typer |
| 2 | +from pathlib import Path |
| 3 | +from typing import Optional |
| 4 | + |
3 | 5 | import dora |
| 6 | +import typer |
| 7 | +from artefacts_toolkit.config import get_artefacts_params |
4 | 8 | from dora.builder import DataflowBuilder |
5 | 9 | from typing_extensions import Annotated |
6 | | -from typing import Optional |
7 | | -from pathlib import Path |
8 | 10 |
|
9 | 11 | workspace_path = Path(__file__).parent.parent.parent.parent |
10 | 12 | nodes_path = workspace_path / "nodes" |
@@ -75,7 +77,7 @@ def run_dataflow( |
75 | 77 | help=( |
76 | 78 | "Policy folder name inside 'policies' or absolute path. " |
77 | 79 | f"Available: {', '.join(available_policy_folders) if available_policy_folders else 'none detected'}. " |
78 | | - "Default: GO2_POLICY_PATH env or 'complete'." |
| 80 | + "Default: GO2_POLICY_PATH env or 'baseline'." |
79 | 81 | ) |
80 | 82 | ), |
81 | 83 | ] = None, |
@@ -104,7 +106,14 @@ def run_dataflow( |
104 | 106 | if not policy: |
105 | 107 | policy = os.getenv("GO2_POLICY_PATH") |
106 | 108 | if not policy: |
107 | | - policy = "complete" |
| 109 | + policy = "baseline" |
| 110 | + |
| 111 | + # Use the policy set with Artefacts parameters if available |
| 112 | + try: |
| 113 | + policy = get_artefacts_params().get("policy", policy) |
| 114 | + except Exception: |
| 115 | + # Not executing within Artefacts context |
| 116 | + pass |
108 | 117 |
|
109 | 118 | if policy in available_policy_folders: |
110 | 119 | policy = policies_folder / policy |
@@ -151,10 +160,13 @@ def run_dataflow( |
151 | 160 | policy_controller.add_input("command_2d", "navigator/command_2d") |
152 | 161 |
|
153 | 162 | # Add the tester node |
| 163 | + junit_xml_path = ( |
| 164 | + output_path / ".." / "tests_junit.xml" |
| 165 | + ) # Save junit in the root outputs folder |
154 | 166 | tester = dataflow.add_node( |
155 | 167 | id="tester", |
156 | 168 | path="pytest", |
157 | | - args=f"{nodes_path / 'tester/tester' / test} -s --junit-xml={str(output_path / 'tests_junit.xml')}", |
| 169 | + args=f"{nodes_path / 'tester/tester' / test} -s --junit-xml={str(junit_xml_path)}", |
158 | 170 | ) |
159 | 171 | tester.add_input("waypoints", "simulation/waypoints") |
160 | 172 | tester.add_input("scene_info", "simulation/scene_info") |
|
0 commit comments