Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.

Commit b982159

Browse files
committed
remove validate task
1 parent 3be991e commit b982159

File tree

4 files changed

+2
-49
lines changed

4 files changed

+2
-49
lines changed

engine/common/base.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ class BaseModel {
2020
virtual void GetModels(
2121
const HttpRequestPtr& req,
2222
std::function<void(const HttpResponsePtr&)>&& callback) = 0;
23-
virtual void GetEngines(
24-
const HttpRequestPtr& req,
25-
std::function<void(const HttpResponsePtr&)>&& callback) = 0;
2623
virtual void FineTuning(
2724
const HttpRequestPtr& req,
2825
std::function<void(const HttpResponsePtr&)>&& callback) = 0;
@@ -48,4 +45,4 @@ class BaseEmbedding {
4845
std::function<void(const HttpResponsePtr&)>&& callback) = 0;
4946

5047
// The derived class can also override other methods if needed
51-
};
48+
};

engine/services/download_service.cc

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -27,43 +27,9 @@ size_t WriteCallback(char* ptr, size_t size, size_t nmemb, void* userdata) {
2727
}
2828
} // namespace
2929

30-
cpp::result<void, std::string> DownloadService::VerifyDownloadTask(
31-
DownloadTask& task) const noexcept {
32-
CLI_LOG("Validating download items, please wait..");
33-
34-
auto total_download_size{0};
35-
std::optional<std::string> err_msg = std::nullopt;
36-
37-
for (auto& item : task.items) {
38-
auto file_size = GetFileSize(item.downloadUrl);
39-
if (file_size.has_error()) {
40-
err_msg = file_size.error();
41-
break;
42-
}
43-
44-
item.bytes = file_size.value();
45-
total_download_size += file_size.value();
46-
}
47-
48-
if (err_msg.has_value()) {
49-
CTL_ERR(err_msg.value());
50-
return cpp::fail(err_msg.value());
51-
}
52-
53-
return {};
54-
}
55-
5630
cpp::result<bool, std::string> DownloadService::AddDownloadTask(
5731
DownloadTask& task,
5832
std::optional<OnDownloadTaskSuccessfully> callback) noexcept {
59-
auto validating_result = VerifyDownloadTask(task);
60-
if (validating_result.has_error()) {
61-
return cpp::fail(validating_result.error());
62-
}
63-
64-
// all items are valid, start downloading
65-
// if any item from the task failed to download, the whole task will be
66-
// considered failed
6733
std::optional<std::string> dl_err_msg = std::nullopt;
6834
bool has_task_done = false;
6935
for (const auto& item : task.items) {
@@ -262,7 +228,7 @@ void DownloadService::ProcessTask(DownloadTask& task) {
262228

263229
active_task_ = std::make_shared<DownloadTask>(task);
264230

265-
for (auto& item : task.items) {
231+
for (const auto& item : task.items) {
266232
auto handle = curl_easy_init();
267233
if (handle == nullptr) {
268234
// skip the task
@@ -408,11 +374,6 @@ void DownloadService::ProcessCompletedTransfers() {
408374

409375
cpp::result<DownloadTask, std::string> DownloadService::AddTask(
410376
DownloadTask& task, std::function<void(const DownloadTask&)> callback) {
411-
auto validate_result = VerifyDownloadTask(task);
412-
if (validate_result.has_error()) {
413-
return cpp::fail(validate_result.error());
414-
}
415-
416377
{
417378
std::lock_guard<std::mutex> lock(callbacks_mutex_);
418379
callbacks_[task.id] = std::move(callback);

engine/services/download_service.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,6 @@ class DownloadService {
8686
DownloadService* download_service;
8787
};
8888

89-
cpp::result<void, std::string> VerifyDownloadTask(
90-
DownloadTask& task) const noexcept;
91-
9289
cpp::result<bool, std::string> Download(
9390
const std::string& download_id,
9491
const DownloadItem& download_item) noexcept;

engine/services/inference_service.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ class InferenceService {
4646

4747
InferResult GetModels(std::shared_ptr<Json::Value> json_body);
4848

49-
Json::Value GetEngines(std::shared_ptr<Json::Value> json_body);
50-
5149
InferResult FineTuning(std::shared_ptr<Json::Value> json_body);
5250

5351
private:

0 commit comments

Comments
 (0)