Skip to content

Commit

Permalink
[featured]: Add database services for DPU (#84)
Browse files Browse the repository at this point in the history
According to the dpu number to start corresponding database container instances.

Signed-off-by: Ze Gan <[email protected]>
  • Loading branch information
Pterosaur authored Nov 30, 2023
1 parent 445ec8b commit e8ae2af
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion scripts/featured
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ class Feature(object):
self.delayed = safe_eval(feature_cfg.get('delayed', 'False'))
self.has_global_scope = safe_eval(feature_cfg.get('has_global_scope', 'True'))
self.has_per_asic_scope = safe_eval(self._get_feature_table_key_render_value(feature_cfg.get('has_per_asic_scope', 'False'), device_config or {}, ['True', 'False']))
self.has_per_dpu_scope = safe_eval(feature_cfg.get('has_per_dpu_scope', 'False'))

def _get_feature_table_key_render_value(self, configuration, device_config, expected_values):
""" Returns the target value for the feature by rendering the configuration as J2 template.
Expand Down Expand Up @@ -131,6 +132,7 @@ class FeatureHandler(object):
self._device_running_config = device_info.get_device_runtime_metadata()
self.ns_cfg_db = {}
self.ns_feature_state_tbl = {}
self.num_dpus = device_info.get_num_dpus()

# Initlaize Global config that loads all database*.json
if self.is_multi_npu:
Expand Down Expand Up @@ -364,7 +366,9 @@ class FeatureHandler(object):
feature_names = (
([feature.name] if feature.has_global_scope or not self.is_multi_npu else []) +
([(feature.name + '@' + str(asic_inst)) for asic_inst in range(device_info.get_num_npus())
if self.is_multi_npu and (all_instance or feature.has_per_asic_scope)])
if self.is_multi_npu and (all_instance or feature.has_per_asic_scope)]) +
([(feature.name + '@' + device_info.DPU_NAME_PREFIX + str(dpu_inst)) for dpu_inst in range(self.num_dpus)
if all_instance or feature.has_per_dpu_scope])
)

if not feature_names:
Expand Down

0 comments on commit e8ae2af

Please sign in to comment.