예제 #1
0
    def register_static_profiling_result(cls, id_,
                                         static_result: StaticProfileResultBO):
        """Register or update static profiling result to a model.

        Args:
             id_ (str): ID of the object
             static_result (StaticProfileResultBO): static profiling result

         Return:
             int: number of affected rows

         Raises:
            DoesNotExistException: `model.id` does not exist in ModelDB
        """
        id_ = ObjectId(id_)
        if cls.__model_DAO.exists_by_id(id_):
            return ModelService.__model_DAO.register_static_profiling_result(
                id_, static_result.to_static_profile_result_po())
        else:
            raise DoesNotExistException(
                'Model ID {} does not exist.'.format(id_))
예제 #2
0
def test_register_static_profiling_result():
    model = ModelService.get_models('ResNet50')[0]
    spr = StaticProfileResultBO(5000, 200000, 200000, 10000, 10000, 10000)
    assert ModelService.register_static_profiling_result(model.id, spr)