mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 01:25:21 +00:00
fac1be9700
- This commit restores statements "SYSTEM RELOAD MODEL(S)" which provide a mechanism to update a model explicitly. It also saves potentially unnecessary reloads of a model from disk after it's initial load. To keep the complexity low, the semantics of "SYSTEM RELOAD MODEL(S) was changed from eager to lazy. This means that both statements previously immedately reloaded the specified/all models, whereas now the statements only trigger an unload and the first call to catboostEvaluate() does the actual load. - Monitoring view SYSTEM.MODELS is also restored but with some obsolete fields removed. The view was not documented in the past and for now it remains undocumented. The commit is thus not considered a breach of ClickHouse's public interface.
35 lines
769 B
C++
35 lines
769 B
C++
#pragma once
|
|
|
|
#include "CatBoostLibraryHandler.h"
|
|
|
|
#include <base/defines.h>
|
|
#include <Common/ExternalModelInfo.h>
|
|
|
|
#include <chrono>
|
|
#include <mutex>
|
|
#include <unordered_map>
|
|
|
|
|
|
namespace DB
|
|
{
|
|
|
|
class CatBoostLibraryHandlerFactory final : private boost::noncopyable
|
|
{
|
|
public:
|
|
static CatBoostLibraryHandlerFactory & instance();
|
|
|
|
CatBoostLibraryHandlerPtr getOrCreateModel(const String & model_path, const String & library_path, bool create_if_not_found);
|
|
|
|
void removeModel(const String & model_path);
|
|
void removeAllModels();
|
|
|
|
ExternalModelInfos getModelInfos();
|
|
|
|
private:
|
|
/// map: model path --> catboost library handler
|
|
std::unordered_map<String, CatBoostLibraryHandlerPtr> library_handlers TSA_GUARDED_BY(mutex);
|
|
std::mutex mutex;
|
|
};
|
|
|
|
}
|