Signed-off-by: isaacncz <isaac.ng@intel.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: lvliang-intel <liang1.lv@intel.com> Co-authored-by: chen, suyue <suyue.chen@intel.com> Co-authored-by: ZePan110 <ze.pan@intel.com>
This commit is contained in:
@@ -107,8 +107,19 @@ class Gateway:
|
||||
|
||||
def list_service(self):
|
||||
response = {}
|
||||
for node in self.all_leaves():
|
||||
response = {self.services[node].description: self.services[node].endpoint_path}
|
||||
for node, service in self.megaservice.services.items():
|
||||
# Check if the service has a 'description' attribute and it is not None
|
||||
if hasattr(service, "description") and service.description:
|
||||
response[node] = {"description": service.description}
|
||||
# Check if the service has an 'endpoint' attribute and it is not None
|
||||
if hasattr(service, "endpoint") and service.endpoint:
|
||||
if node in response:
|
||||
response[node]["endpoint"] = service.endpoint
|
||||
else:
|
||||
response[node] = {"endpoint": service.endpoint}
|
||||
# If neither 'description' nor 'endpoint' is available, add an error message for the node
|
||||
if node not in response:
|
||||
response[node] = {"error": f"Service node {node} does not have 'description' or 'endpoint' attribute."}
|
||||
return response
|
||||
|
||||
def list_parameter(self):
|
||||
|
||||
@@ -38,6 +38,7 @@ class MicroService:
|
||||
provider: Optional[str] = None,
|
||||
provider_endpoint: Optional[str] = None,
|
||||
use_remote_service: Optional[bool] = False,
|
||||
description: Optional[str] = None,
|
||||
dynamic_batching: bool = False,
|
||||
dynamic_batching_timeout: int = 1,
|
||||
dynamic_batching_max_batch_size: int = 32,
|
||||
@@ -53,6 +54,7 @@ class MicroService:
|
||||
self.input_datatype = input_datatype
|
||||
self.output_datatype = output_datatype
|
||||
self.use_remote_service = use_remote_service
|
||||
self.description = description
|
||||
self.dynamic_batching = dynamic_batching
|
||||
self.dynamic_batching_timeout = dynamic_batching_timeout
|
||||
self.dynamic_batching_max_batch_size = dynamic_batching_max_batch_size
|
||||
|
||||
Reference in New Issue
Block a user