Commit 5495ba0b authored by Antonio Gines Buendia Lopez's avatar Antonio Gines Buendia Lopez
Browse files

WIP - Renames client class for extended path computation

Replaces references to PathCompClient with PathCompExtendedClient
across various modules to reflect a more accurate naming convention.
Updates base URL configuration for the backend service and removes
unused Python package dependencies. Introduces placeholder function
for potential HRAT enablement checking.

Relates to feat/364-elig-path-computation-extended-component-pce-for-externalized-optical-slice-computation
parent 2cac9333
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@
import logging
from flask_restful import Resource, request
from flask.json import jsonify
from pathcompextended.client.PathCompClient import PathCompClient
from pathcompextended.client.PathCompClient import PathCompExtendedClient

LOGGER = logging.getLogger(__name__)

@@ -23,7 +23,7 @@ LOGGER = logging.getLogger(__name__)
class _Resource(Resource):
    def __init__(self) -> None:
        super().__init__()
        self.pathcompextended_client = PathCompClient()
        self.pathcompextended_client = PathCompExtendedClient()


class Index(_Resource):
+6 −1
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ from common.Settings import get_setting, is_deployed_forecaster
DEFAULT_PATHCOMPEXTENDED_BACKEND_SCHEME  = 'http'
DEFAULT_PATHCOMPEXTENDED_BACKEND_HOST    = '127.0.0.1'
DEFAULT_PATHCOMPEXTENDED_BACKEND_PORT    = '8081'
DEFAULT_PATHCOMPEXTENDED_BACKEND_BASEURL = '/pathCompExtended/api/v1/compRoute'
DEFAULT_PATHCOMPEXTENDED_BACKEND_BASEURL = '/pathCompExtended/api/v1'

PATHCOMPEXTENDED_BACKEND_SCHEME  = str(os.environ.get('PATHCOMPEXTENDED_BACKEND_SCHEME',  DEFAULT_PATHCOMPEXTENDED_BACKEND_SCHEME ))
PATHCOMPEXTENDED_BACKEND_BASEURL = str(os.environ.get('PATHCOMPEXTENDED_BACKEND_BASEURL', DEFAULT_PATHCOMPEXTENDED_BACKEND_BASEURL))
@@ -43,6 +43,11 @@ BACKEND_URL = '{:s}://{:s}:{:d}{:s}'.format(
SETTING_NAME_ENABLE_FORECASTER = 'ENABLE_FORECASTER'
TRUE_VALUES = {'Y', 'YES', 'TRUE', 'T', 'E', 'ENABLE', 'ENABLED'}

def is_hrat_enabled() -> bool:
    pass
    # Get the configuration from the config


def is_forecaster_enabled() -> bool:
    if not is_deployed_forecaster(): return False
    is_enabled = get_setting(SETTING_NAME_ENABLE_FORECASTER, default=None)
+10 −1
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@ MAX_RETRIES = 15
DELAY_FUNCTION = delay_exponential(initial=0.01, increment=2.0, maximum=5.0)
RETRY_DECORATOR = retry(max_retries=MAX_RETRIES, delay_function=DELAY_FUNCTION, prepare_method_name='connect')

class PathCompClient:
class PathCompExtendedClient:
    def __init__(self, host=None, port=None):
        if not host: host = get_service_host(ServiceNameEnum.PATHCOMPEXTENDED)
        if not port: port = get_service_port_grpc(ServiceNameEnum.PATHCOMPEXTENDED)
@@ -45,6 +45,15 @@ class PathCompClient:
        self.channel = None
        self.stub = None


    @RETRY_DECORATOR
    def HealthCheck(self):
        





    @RETRY_DECORATOR
    def Compute(self, request : PathCompRequest) -> PathCompReply:
        LOGGER.debug('Compute request: {:s}'.format(grpc_message_to_json_string(request)))
+0 −3
Original line number Diff line number Diff line
@@ -13,7 +13,4 @@
# limitations under the License.


numpy<2.0.0
pandas==1.5.*
requests==2.27.1
scikit-learn==1.1.*
+2 −2
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@ from context.client.ContextClient import ContextClient
from forecaster.client.ForecasterClient import ForecasterClient
from forecaster.service.ForecasterService import ForecasterService
from monitoring.client.MonitoringClient import MonitoringClient
from pathcompextended.client.PathCompClient import PathCompClient
from pathcompextended.client.PathCompClient import PathCompExtendedClient
from pathcompextended.service.PathCompService import PathCompService
from .MockService_Dependencies import MockService_Dependencies

@@ -84,6 +84,6 @@ def pathcompextended_service(

@pytest.fixture(scope='session')
def pathcompextended_client(pathcompextended_service : PathCompService):    # pylint: disable=redefined-outer-name
    _client = PathCompClient()
    _client = PathCompExtendedClient()
    yield _client
    _client.close()
Loading