dfd4fe157a74c5cca93bbb408ae83e0d1bd48077,python/seldon_core/user_model.py,,client_custom_metrics,#Any#Any#Any#Any#,325

Before Change


        try:
            metrics = user_model.metrics()
            if not validate_metrics(metrics):
                j_str = json.dumps(metrics)
                raise SeldonMicroserviceException(
                    "Bad metric created during request: " + j_str,
                    status_code=500,
                    reason="MICROSERVICE_BAD_METRIC",

After Change


       A list of custom metrics

    
    if not validate_metrics(runtime_metrics):
        raise SeldonMicroserviceException(
            f"Bad metric created during request: {json.dumps(runtime_metrics)}",
            status_code=500,
            reason="MICROSERVICE_BAD_METRIC",
        )
    seldon_metrics.update(runtime_metrics, method)

    if hasattr(user_model, "metrics"):
        try:
            metrics = user_model.metrics()
            if not validate_metrics(metrics):
                raise SeldonMicroserviceException(
                    f"Bad metric created during request: {json.dumps(metrics)}",
                    status_code=500,
                    reason="MICROSERVICE_BAD_METRIC",
                )

            seldon_metrics.update(metrics, method)
            if INCLUDE_METRICS_IN_CLIENT_RESPONSE:
                return metrics + runtime_metrics
            else:
                return []
        except SeldonNotImplementedError:
            pass
    logger.debug("custom_metrics is not implemented")
    if INCLUDE_METRICS_IN_CLIENT_RESPONSE:
        return runtime_metrics
    else:
        return []


def client_feature_names(
    user_model: SeldonComponent, original: Iterable[str]
) -> Iterable[str]:
    
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: SeldonIO/seldon-core
Commit Name: dfd4fe157a74c5cca93bbb408ae83e0d1bd48077
Time: 2020-09-18
Author: r.j.skolasinski@gmail.com
File Name: python/seldon_core/user_model.py
Class Name:
Method Name: client_custom_metrics


Project Name: chakki-works/doccano
Commit Name: 49d41416e440926f0a9a8243b4d77f6f5468efe9
Time: 2019-03-12
Author: light.tree.1.13@gmail.com
File Name: app/server/utils.py
Class Name: JsonHandler
Method Name: parse


Project Name: horovod/horovod
Commit Name: cb6bb26d0f5469f48d054196764c04f6d7bce797
Time: 2020-06-13
Author: github@enrico.minack.dev
File Name: test/integration/elastic_common.py
Class Name: BaseElasticTests
Method Name: _run