Skip to content

Commit 3260175

Browse files
authored
[PROD-1987] Raise dbfs missing files runtime error (#117)
* Raise dbfs missing files runtime error * Bump version
1 parent a745394 commit 3260175

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

sync/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""Library for leveraging the power of Sync"""
22

3-
__version__ = "1.8.0"
3+
__version__ = "1.8.1"
44

55
TIME_FORMAT = "%Y-%m-%dT%H:%M:%SZ"

sync/_databricks.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from sync.api import projects
1919
from sync.clients.databricks import get_default_client
2020
from sync.config import CONFIG # noqa F401
21+
from sync.errors import DatabricksDBFSMissingFiles
2122
from sync.models import (
2223
DatabricksAPIError,
2324
DatabricksClusterReport,
@@ -1459,6 +1460,10 @@ def _get_eventlog_from_dbfs(
14591460

14601461
prefix = format_dbfs_filepath(f"{base_filepath}/eventlog/")
14611462
root_dir = dbx_client.list_dbfs_directory(prefix)
1463+
1464+
if "files" not in root_dir:
1465+
raise DatabricksDBFSMissingFiles("Unable to locate files in DBFS dir - prefix:%s", prefix)
1466+
14621467
eventlog_files = [f for f in root_dir["files"] if f["is_dir"]]
14631468
matching_subdirectory = None
14641469

sync/errors.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
class DatabricksDBFSMissingFiles(RuntimeError):
2+
def __init__(
3+
self,
4+
message,
5+
):
6+
super().__init__(message)

0 commit comments

Comments
 (0)