rasa/core/agent.py
async def _pull_model_and_fingerprint(model_server: EndpointConfig,
                                      model_directory: Text,
                                      fingerprint: Optional[Text]
                                      ) -> Optional[Text]:
    """Queries the model server and returns the value of the response's

     <ETag> header which contains the model hash.
     """

    headers = {"If-None-Match": fingerprint}

    logger.debug("Requesting model from server {}..."
                 "".format(model_server.url))

    async with model_server.session() as session:
        try:
            params = model_server.combine_parameters()
            async with session.request("GET",
                                       model_server.url,
                                       timeout=DEFAULT_REQUEST_TIMEOUT,
                                       headers=headers,
                                       params=params) as resp:

                if resp.status in [204, 304]:
                    logger.debug("Model server returned {} status code, "
                                 "indicating that no new model is available. "
                                 "Current fingerprint: {}"
                                 "".format(resp.status, fingerprint))
                    return resp.headers.get("ETag")
                elif resp.status == 404:
                    logger.debug(
                        "Model server didn't find a model for our request. "
                        "Probably no one did train a model for the project "
                        "and tag combination yet.")
                    return None
                elif resp.status != 200:
                    logger.warning(
                        "Tried to fetch model from server, but server response "
                        "status code is {}. We'll retry later..."
                        "".format(resp.status))
                    return None

                utils.unarchive(await resp.read(), model_directory)
                logger.debug("Unzipped model to '{}'"
                             "".format(os.path.abspath(model_directory)))

                # get the new fingerprint
                return resp.headers.get("ETag")

        except aiohttp.ClientResponseError as e:
            logger.warning("Tried to fetch model from server, but "
                           "couldn't reach server. We'll retry later... "
                           "Error: {}.".format(e))
            return None
Queries the model server and returns the value of the response's

     <ETag> header which contains the model hash.
     
Queries the model server and returns the value of the response's
 header which contains the model hash.
Queries the model server and returns the value of the response ' s header which contains the model hash .
async def _pull_model_and_fingerprint(model_server: EndpointConfig,
                                      model_directory: Text,
                                      fingerprint: Optional[Text]
                                      ) -> Optional[Text]:
    headers = {"If-None-Match": fingerprint}
    logger.debug("Requesting model from server {}..."
                 "".format(model_server.url))
    async with model_server.session() as session:
        try:
            params = model_server.combine_parameters()
            async with session.request("GET",
                                       model_server.url,
                                       timeout=DEFAULT_REQUEST_TIMEOUT,
                                       headers=headers,
                                       params=params) as resp:
                if resp.status in [204, 304]:
                    logger.debug("Model server returned {} status code, "
                                 "indicating that no new model is available. "
                                 "Current fingerprint: {}"
                                 "".format(resp.status, fingerprint))
                    return resp.headers.get("ETag")
                elif resp.status == 404:
                    logger.debug(
                        "Model server didn't find a model for our request. "
                        "Probably no one did train a model for the project "
                        "and tag combination yet.")
                    return None
                elif resp.status != 200:
                    logger.warning(
                        "Tried to fetch model from server, but server response "
                        "status code is {}. We'll retry later..."
                        "".format(resp.status))
                    return None
                utils.unarchive(await resp.read(), model_directory)
                logger.debug("Unzipped model to '{}'"
                             "".format(os.path.abspath(model_directory)))
                return resp.headers.get("ETag")
        except aiohttp.ClientResponseError as e:
            logger.warning("Tried to fetch model from server, but "
                           "couldn't reach server. We'll retry later... "
                           "Error: {}.".format(e))
            return None
async def _pull_model_and_fingerprint ( model_server : EndpointConfig , model_directory : Text , fingerprint : Optional [ Text ] ) -> Optional [ Text ] : headers = { "If-None-Match" : fingerprint } logger . debug ( "Requesting model from server {}..." "" . format ( model_server . url ) ) async with model_server . session ( ) as session : try : params = model_server . combine_parameters ( ) async with session . request ( "GET" , model_server . url , timeout = DEFAULT_REQUEST_TIMEOUT , headers = headers , params = params ) as resp : if resp . status in [ 204 , 304 ] : logger . debug ( "Model server returned {} status code, " "indicating that no new model is available. " "Current fingerprint: {}" "" . format ( resp . status , fingerprint ) ) return resp . headers . get ( "ETag" ) elif resp . status == 404 : logger . debug ( "Model server didn't find a model for our request. " "Probably no one did train a model for the project " "and tag combination yet." ) return None elif resp . status != 200 : logger . warning ( "Tried to fetch model from server, but server response " "status code is {}. We'll retry later..." "" . format ( resp . status ) ) return None utils . unarchive ( await resp . read ( ) , model_directory ) logger . debug ( "Unzipped model to '{}'" "" . format ( os . path . abspath ( model_directory ) ) ) return resp . headers . get ( "ETag" ) except aiohttp . ClientResponseError as e : logger . warning ( "Tried to fetch model from server, but " "couldn't reach server. We'll retry later... " "Error: {}." . format ( e ) ) return None
Queries the model server and returns the value of the response's
<ETag> header which contains the model hash.
Queries the model server and returns the value of the response ' s <ETag > header which contains the model hash .
"""Queries the model server and returns the value of the response's

     <ETag> header which contains the model hash.
     """ # get the new fingerprint
model_server
EndpointConfig
model_directory
Text
fingerprint
Optional[Text]