|
11 | 11 | from databricks.labs.blueprint.paths import DBFSPath |
12 | 12 | from databricks.sdk import WorkspaceClient |
13 | 13 | from databricks.sdk.errors import ResourceDoesNotExist, BadRequest, InvalidParameterValue, DatabricksError |
14 | | -from databricks.sdk.service import compute, jobs |
| 14 | +from databricks.sdk.service import compute, jobs, pipelines |
15 | 15 | from databricks.sdk.service.compute import DataSecurityMode |
16 | 16 | from databricks.sdk.service.jobs import Source |
17 | 17 |
|
@@ -286,24 +286,31 @@ def _register_pipeline_task(self, graph: DependencyGraph) -> Iterable[Dependency |
286 | 286 | if not self._task.pipeline_task: |
287 | 287 | return |
288 | 288 |
|
289 | | - pipeline = self._ws.pipelines.get(self._task.pipeline_task.pipeline_id) |
290 | | - if not pipeline.spec: |
| 289 | + try: |
| 290 | + pipeline = self._ws.pipelines.get(self._task.pipeline_task.pipeline_id) |
| 291 | + except ResourceDoesNotExist: |
| 292 | + yield DependencyProblem( |
| 293 | + 'pipeline-not-found', f'Could not find pipeline: {self._task.pipeline_task.pipeline_id}' |
| 294 | + ) |
291 | 295 | return |
292 | | - if not pipeline.spec.libraries: |
| 296 | + |
| 297 | + if not pipeline.spec or not pipeline.spec.libraries: |
293 | 298 | return |
294 | 299 |
|
295 | | - pipeline_libraries = pipeline.spec.libraries |
296 | | - for library in pipeline_libraries: |
297 | | - if not library.notebook: |
298 | | - return |
299 | | - if library.notebook.path: |
300 | | - yield from self._register_notebook_path(graph, library.notebook.path) |
301 | | - if library.jar: |
302 | | - yield from self._register_library(graph, compute.Library(jar=library.jar)) |
303 | | - if library.maven: |
304 | | - yield DependencyProblem('not-yet-implemented', 'Maven library is not yet implemented') |
305 | | - if library.file: |
306 | | - yield DependencyProblem('not-yet-implemented', 'File library is not yet implemented') |
| 300 | + for library in pipeline.spec.libraries: |
| 301 | + yield from self._register_pipeline_library(graph, library) |
| 302 | + |
| 303 | + def _register_pipeline_library( |
| 304 | + self, graph: DependencyGraph, library: pipelines.PipelineLibrary |
| 305 | + ) -> Iterable[DependencyProblem]: |
| 306 | + if library.notebook and library.notebook.path: |
| 307 | + yield from self._register_notebook_path(graph, library.notebook.path) |
| 308 | + if library.jar: |
| 309 | + yield from self._register_library(graph, compute.Library(jar=library.jar)) |
| 310 | + if library.maven: |
| 311 | + yield DependencyProblem('not-yet-implemented', 'Maven library is not yet implemented') |
| 312 | + if library.file: |
| 313 | + yield DependencyProblem('not-yet-implemented', 'File library is not yet implemented') |
307 | 314 |
|
308 | 315 | def _register_notebook_path(self, graph: DependencyGraph, notebook_path: str) -> Iterable[DependencyProblem]: |
309 | 316 | try: |
|
0 commit comments