-
Notifications
You must be signed in to change notification settings - Fork 194
Expand file tree
/
Copy pathcluster_log_conf.py
More file actions
82 lines (66 loc) · 2.62 KB
/
Copy pathcluster_log_conf.py
File metadata and controls
82 lines (66 loc) · 2.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
from dataclasses import dataclass
from typing import TYPE_CHECKING, TypedDict
from databricks.bundles.core._transform import _transform
from databricks.bundles.core._transform_to_json import _transform_to_json_value
from databricks.bundles.core._variable import VariableOrOptional
from databricks.bundles.jobs._models.dbfs_storage_info import (
DbfsStorageInfo,
DbfsStorageInfoParam,
)
from databricks.bundles.jobs._models.s3_storage_info import (
S3StorageInfo,
S3StorageInfoParam,
)
from databricks.bundles.jobs._models.volumes_storage_info import (
VolumesStorageInfo,
VolumesStorageInfoParam,
)
if TYPE_CHECKING:
from typing_extensions import Self
@dataclass(kw_only=True)
class ClusterLogConf:
"""
Cluster log delivery config
"""
dbfs: VariableOrOptional[DbfsStorageInfo] = None
"""
destination needs to be provided. e.g.
`{ "dbfs" : { "destination" : "dbfs:/home/cluster_log" } }`
"""
s3: VariableOrOptional[S3StorageInfo] = None
"""
destination and either the region or endpoint need to be provided. e.g.
`{ "s3": { "destination" : "s3://cluster_log_bucket/prefix", "region" : "us-west-2" } }`
Cluster iam role is used to access s3, please make sure the cluster iam role in
`instance_profile_arn` has permission to write data to the s3 destination.
"""
volumes: VariableOrOptional[VolumesStorageInfo] = None
"""
destination needs to be provided, e.g.
`{ "volumes": { "destination": "/Volumes/catalog/schema/volume/cluster_log" } }`
"""
@classmethod
def from_dict(cls, value: "ClusterLogConfDict") -> "Self":
return _transform(cls, value)
def as_dict(self) -> "ClusterLogConfDict":
return _transform_to_json_value(self) # type:ignore
class ClusterLogConfDict(TypedDict, total=False):
""""""
dbfs: VariableOrOptional[DbfsStorageInfoParam]
"""
destination needs to be provided. e.g.
`{ "dbfs" : { "destination" : "dbfs:/home/cluster_log" } }`
"""
s3: VariableOrOptional[S3StorageInfoParam]
"""
destination and either the region or endpoint need to be provided. e.g.
`{ "s3": { "destination" : "s3://cluster_log_bucket/prefix", "region" : "us-west-2" } }`
Cluster iam role is used to access s3, please make sure the cluster iam role in
`instance_profile_arn` has permission to write data to the s3 destination.
"""
volumes: VariableOrOptional[VolumesStorageInfoParam]
"""
destination needs to be provided, e.g.
`{ "volumes": { "destination": "/Volumes/catalog/schema/volume/cluster_log" } }`
"""
ClusterLogConfParam = ClusterLogConfDict | ClusterLogConf