File tree 2 files changed +6
-4
lines changed
src/codeflare_sdk/ray/cluster
2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -191,7 +191,7 @@ def get_metadata(cluster: "codeflare_sdk.ray.cluster.Cluster"):
191
191
)
192
192
193
193
# Get the NB annotation if it exists - could be useful in future for a "annotations" parameter.
194
- annotations = get_nb_annotations ( )
194
+ annotations = get_annotations ( cluster . config . annotations )
195
195
if annotations != {}:
196
196
object_meta .annotations = annotations # As annotations are not a guarantee they are appended to the metadata after creation.
197
197
return object_meta
@@ -213,11 +213,10 @@ def get_labels(cluster: "codeflare_sdk.ray.cluster.Cluster"):
213
213
return labels
214
214
215
215
216
- def get_nb_annotations ( ):
216
+ def get_annotations ( annotations ):
217
217
"""
218
- The get_nb_annotations () function generates the annotation for NB Prefix if the SDK is running in a notebook
218
+ The get_annotations () function generates the annotation for NB Prefix if the SDK is running in a notebook and appends any user set annotations
219
219
"""
220
- annotations = {}
221
220
222
221
# Notebook annotation
223
222
nb_prefix = os .environ .get ("NB_PREFIX" )
Original file line number Diff line number Diff line change @@ -89,6 +89,8 @@ class ClusterConfiguration:
89
89
A dictionary of custom resource mappings to map extended resource requests to RayCluster resource names
90
90
overwrite_default_resource_mapping:
91
91
A boolean indicating whether to overwrite the default resource mapping.
92
+ annotations:
93
+ A dictionary of annotations to apply to the cluster.
92
94
"""
93
95
94
96
name : str
@@ -126,6 +128,7 @@ class ClusterConfiguration:
126
128
extended_resource_mapping : Dict [str , str ] = field (default_factory = dict )
127
129
overwrite_default_resource_mapping : bool = False
128
130
local_queue : Optional [str ] = None
131
+ annotations : Dict [str , str ] = field (default_factory = dict )
129
132
130
133
def __post_init__ (self ):
131
134
if not self .verify_tls :
You can’t perform that action at this time.
0 commit comments