Loading src/service/requirements.in +2 −2 Original line number Diff line number Diff line Loading @@ -14,7 +14,7 @@ anytree==2.8.0 geopy==2.3.0 networkx==2.6.3 pydot==1.4.2 redis==4.1.2 No newline at end of file geopy==2.3.0 No newline at end of file src/service/service/ServiceServiceServicerImpl.py +4 −7 Original line number Diff line number Diff line Loading @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. import grpc, json, logging import copy, grpc, json, logging from typing import Optional from common.method_wrappers.Decorator import MetricsPool, safe_and_metered_rpc_method from common.method_wrappers.ServiceExceptions import AlreadyExistsException, InvalidArgumentException Loading @@ -26,7 +26,6 @@ from pathcomp.frontend.client.PathCompClient import PathCompClient from .service_handler_api.ServiceHandlerFactory import ServiceHandlerFactory from .task_scheduler.TaskScheduler import TasksScheduler from .tools.GeodesicDistance import gps_distance import copy LOGGER = logging.getLogger(__name__) Loading Loading @@ -121,16 +120,14 @@ class ServiceServiceServicerImpl(ServiceServiceServicer): for config_rule in request.service_config.config_rules: service.service_config.config_rules.add().CopyFrom(config_rule) # pylint: disable=no-member for constraint in request.service_constraints: if constraint.WhichOneof('constraint') == 'endpoint_location': context_client = ContextClient() device_list = context_client.ListDevices(Empty()) service_location = constraint.endpoint_location.location distances = {} for device in device_list.devices: for endpoint in device.device_endpoints: if endpoint.endpoint_location.HasField('gps_position'): if not endpoint.endpoint_location.HasField('gps_position'): continue distance = gps_distance(service_location.gps_position, endpoint.endpoint_location.gps_position) distances[distance] = endpoint.endpoint_id Loading Loading
src/service/requirements.in +2 −2 Original line number Diff line number Diff line Loading @@ -14,7 +14,7 @@ anytree==2.8.0 geopy==2.3.0 networkx==2.6.3 pydot==1.4.2 redis==4.1.2 No newline at end of file geopy==2.3.0 No newline at end of file
src/service/service/ServiceServiceServicerImpl.py +4 −7 Original line number Diff line number Diff line Loading @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. import grpc, json, logging import copy, grpc, json, logging from typing import Optional from common.method_wrappers.Decorator import MetricsPool, safe_and_metered_rpc_method from common.method_wrappers.ServiceExceptions import AlreadyExistsException, InvalidArgumentException Loading @@ -26,7 +26,6 @@ from pathcomp.frontend.client.PathCompClient import PathCompClient from .service_handler_api.ServiceHandlerFactory import ServiceHandlerFactory from .task_scheduler.TaskScheduler import TasksScheduler from .tools.GeodesicDistance import gps_distance import copy LOGGER = logging.getLogger(__name__) Loading Loading @@ -121,16 +120,14 @@ class ServiceServiceServicerImpl(ServiceServiceServicer): for config_rule in request.service_config.config_rules: service.service_config.config_rules.add().CopyFrom(config_rule) # pylint: disable=no-member for constraint in request.service_constraints: if constraint.WhichOneof('constraint') == 'endpoint_location': context_client = ContextClient() device_list = context_client.ListDevices(Empty()) service_location = constraint.endpoint_location.location distances = {} for device in device_list.devices: for endpoint in device.device_endpoints: if endpoint.endpoint_location.HasField('gps_position'): if not endpoint.endpoint_location.HasField('gps_position'): continue distance = gps_distance(service_location.gps_position, endpoint.endpoint_location.gps_position) distances[distance] = endpoint.endpoint_id Loading