зеркало из https://github.com/microsoft/lisa.git
remove unused from_value methods
As final implementation, no need to create capability from value. The capability should be defined, if it's needed. If a capability is not defined, a node uses default capability.
This commit is contained in:
Родитель
929fbc0326
Коммит
ce3d0682bd
|
@ -72,18 +72,6 @@ class EnvironmentSpace(search_space.RequirementMixin):
|
|||
|
||||
return result
|
||||
|
||||
@classmethod
|
||||
def from_value(cls, value: Any) -> Any:
|
||||
assert isinstance(value, EnvironmentSpace), f"actual: {type(value)}"
|
||||
env = EnvironmentSpace()
|
||||
env.nodes = value.nodes
|
||||
if value.nodes:
|
||||
env.nodes = list()
|
||||
for value_capability in value.nodes:
|
||||
env.nodes.append(schema.NodeSpace.from_value(value_capability))
|
||||
|
||||
return env
|
||||
|
||||
def _generate_min_capability(self, capability: Any) -> Any:
|
||||
env = EnvironmentSpace(topology=self.topology)
|
||||
assert isinstance(capability, EnvironmentSpace), f"actual: {type(capability)}"
|
||||
|
|
|
@ -471,30 +471,6 @@ class NodeSpace(search_space.RequirementMixin, ExtendableSchemaMixin):
|
|||
|
||||
return result
|
||||
|
||||
@classmethod
|
||||
def from_value(cls, value: Any) -> Any:
|
||||
assert isinstance(value, NodeSpace), f"actual: {type(value)}"
|
||||
node = NodeSpace()
|
||||
node.node_count = value.node_count
|
||||
node.core_count = value.core_count
|
||||
node.memory_mb = value.memory_mb
|
||||
node.disk_count = value.disk_count
|
||||
node.nic_count = value.nic_count
|
||||
node.gpu_count = value.gpu_count
|
||||
|
||||
if value.features:
|
||||
for feature in value.features:
|
||||
if feature.enabled or feature.can_disable:
|
||||
if not node.features:
|
||||
node.features = search_space.SetSpace[Feature]()
|
||||
node.features.add(feature)
|
||||
else:
|
||||
if not node.excluded_features:
|
||||
node.excluded_features = search_space.SetSpace[Feature]()
|
||||
node.excluded_features.add(feature)
|
||||
|
||||
return node
|
||||
|
||||
def expand_by_node_count(self) -> List[Any]:
|
||||
# expand node count in requirement to one,
|
||||
# so that's easy to compare equalation later.
|
||||
|
|
Загрузка…
Ссылка в новой задаче