|
6 | 6 | execute_test_flow, |
7 | 7 | deploy_flow_to_scheduler, |
8 | 8 | wait_for_deployed_run, |
| 9 | + wait_for_deployed_run_allow_failure, |
9 | 10 | verify_run_provenance, |
10 | 11 | ) |
11 | 12 |
|
@@ -172,3 +173,63 @@ def test_hello_conda(exec_mode, decospecs, compute_env, tag, scheduler_config): |
172 | 173 | assert ( |
173 | 174 | run["combo"].task.data.itsdangerous_version == "2.2.0" |
174 | 175 | ), "itsdangerous version incorrect" |
| 176 | + |
| 177 | + |
| 178 | +@pytest.mark.conda |
| 179 | +def test_build_env_conda(exec_mode, decospecs, compute_env, tag, scheduler_config): |
| 180 | + """Verify that a conda environment can be built at runtime within a step.""" |
| 181 | + run = execute_test_flow( |
| 182 | + flow_name="basic/self_building_env.py", |
| 183 | + exec_mode=exec_mode, |
| 184 | + decospecs=decospecs, |
| 185 | + tag=tag, |
| 186 | + scheduler_config=scheduler_config, |
| 187 | + test_name="build_env_conda", |
| 188 | + tl_args_extra={ |
| 189 | + "environment": "conda", |
| 190 | + "env": compute_env, |
| 191 | + }, |
| 192 | + ) |
| 193 | + |
| 194 | + assert run.successful, "Run was not successful" |
| 195 | + assert ( |
| 196 | + run["fetch_old"].task.data.found_version_old == "2.1.2" |
| 197 | + ), "fetch_old version incorrect" |
| 198 | + assert run["end"].task.data.found_version == "2.1.2", "end version incorrect" |
| 199 | + |
| 200 | + |
| 201 | +@pytest.mark.scheduler_only |
| 202 | +def test_resources_cpu(exec_mode, decospecs, compute_env, tag, scheduler_config): |
| 203 | + """Verify @resources(cpu=N, memory=N) deploys and runs on each scheduler backend.""" |
| 204 | + run = execute_test_flow( |
| 205 | + flow_name="basic/resources_cpu_flow.py", |
| 206 | + exec_mode=exec_mode, |
| 207 | + decospecs=decospecs, |
| 208 | + tag=tag, |
| 209 | + scheduler_config=scheduler_config, |
| 210 | + test_name="resources_cpu", |
| 211 | + tl_args_extra={"env": compute_env}, |
| 212 | + ) |
| 213 | + |
| 214 | + assert run.successful, "Run was not successful" |
| 215 | + assert ( |
| 216 | + run["end"].task.data.message == "Metaflow says: Hi Resources CPU!" |
| 217 | + ), "Message didn't match" |
| 218 | + |
| 219 | + |
| 220 | +@pytest.mark.scheduler_only |
| 221 | +@pytest.mark.skip(reason="devstack has no GPU nodes") |
| 222 | +def test_resources_gpu(exec_mode, decospecs, compute_env, tag, scheduler_config): |
| 223 | + """Verify @resources(gpu=1) deploys successfully (no actual GPU validation).""" |
| 224 | + run = execute_test_flow( |
| 225 | + flow_name="basic/resources_gpu_flow.py", |
| 226 | + exec_mode=exec_mode, |
| 227 | + decospecs=decospecs, |
| 228 | + tag=tag, |
| 229 | + scheduler_config=scheduler_config, |
| 230 | + test_name="resources_gpu", |
| 231 | + tl_args_extra={"env": compute_env}, |
| 232 | + ) |
| 233 | + |
| 234 | + assert run.successful, "Run was not successful" |
| 235 | + assert run["gpu_step"].task.data.gpu_requested is True |
0 commit comments