From a1f7b766a0f81ee3afaf8a3dd2dc3df2066f7976 Mon Sep 17 00:00:00 2001 From: wxyu Date: Fri, 30 Aug 2019 11:11:54 +0800 Subject: [PATCH] MS-445 Rename CopyCompleted to LoadCompleted Former-commit-id: 99d0df4b53e6daa19d91db1e058eaa99c77d980a --- cpp/CHANGELOG.md | 1 + cpp/src/scheduler/Scheduler.cpp | 8 ++++---- cpp/src/scheduler/Scheduler.h | 2 +- cpp/src/scheduler/event/Event.h | 2 +- cpp/src/scheduler/event/EventDump.cpp | 4 ++-- .../{CopyCompletedEvent.h => LoadCompletedEvent.h} | 10 +++++----- cpp/src/scheduler/resource/Resource.cpp | 3 +-- cpp/src/scheduler/resource/Resource.h | 2 +- 8 files changed, 16 insertions(+), 16 deletions(-) rename cpp/src/scheduler/event/{CopyCompletedEvent.h => LoadCompletedEvent.h} (69%) diff --git a/cpp/CHANGELOG.md b/cpp/CHANGELOG.md index 19e96e96..48560215 100644 --- a/cpp/CHANGELOG.md +++ b/cpp/CHANGELOG.md @@ -68,6 +68,7 @@ Please mark all change in change log and use the ticket from JIRA. - MS-428 - Add PushTaskByDataLocality in scheduler - MS-440 - Add DumpTaskTables in sdk - MS-442 - Merge Knowhere +- MS-445 - Rename CopyCompleted to LoadCompleted ## New Feature - MS-343 - Implement ResourceMgr diff --git a/cpp/src/scheduler/Scheduler.cpp b/cpp/src/scheduler/Scheduler.cpp index 4c7f0ce6..03fa479d 100644 --- a/cpp/src/scheduler/Scheduler.cpp +++ b/cpp/src/scheduler/Scheduler.cpp @@ -76,8 +76,8 @@ Scheduler::Process(const EventPtr &event) { OnStartUp(event); break; } - case EventType::COPY_COMPLETED: { - OnCopyCompleted(event); + case EventType::LOAD_COMPLETED: { + OnLoadCompleted(event); break; } case EventType::FINISH_TASK: { @@ -108,8 +108,8 @@ Scheduler::OnFinishTask(const EventPtr &event) { } void -Scheduler::OnCopyCompleted(const EventPtr &event) { - auto load_completed_event = std::static_pointer_cast(event); +Scheduler::OnLoadCompleted(const EventPtr &event) { + auto load_completed_event = std::static_pointer_cast(event); if (auto resource = event->resource_.lock()) { resource->WakeupExecutor(); diff --git a/cpp/src/scheduler/Scheduler.h b/cpp/src/scheduler/Scheduler.h index 012a479a..e2d51ee3 100644 --- a/cpp/src/scheduler/Scheduler.h +++ b/cpp/src/scheduler/Scheduler.h @@ -82,7 +82,7 @@ private: * Pull task from neighbours; */ void - OnCopyCompleted(const EventPtr &event); + OnLoadCompleted(const EventPtr &event); /* * Process task table updated events, which happened on task_table->put; diff --git a/cpp/src/scheduler/event/Event.h b/cpp/src/scheduler/event/Event.h index 788cfd6a..777bede8 100644 --- a/cpp/src/scheduler/event/Event.h +++ b/cpp/src/scheduler/event/Event.h @@ -13,7 +13,7 @@ namespace engine { enum class EventType { START_UP, - COPY_COMPLETED, + LOAD_COMPLETED, FINISH_TASK, TASK_TABLE_UPDATED }; diff --git a/cpp/src/scheduler/event/EventDump.cpp b/cpp/src/scheduler/event/EventDump.cpp index 0d10f6f7..ceee63ba 100644 --- a/cpp/src/scheduler/event/EventDump.cpp +++ b/cpp/src/scheduler/event/EventDump.cpp @@ -6,7 +6,7 @@ #include "Event.h" #include "StartUpEvent.h" -#include "CopyCompletedEvent.h" +#include "LoadCompletedEvent.h" #include "FinishTaskEvent.h" #include "TaskTableUpdatedEvent.h" @@ -25,7 +25,7 @@ std::ostream &operator<<(std::ostream &out, const StartUpEvent &event) { return out; } -std::ostream &operator<<(std::ostream &out, const CopyCompletedEvent &event) { +std::ostream &operator<<(std::ostream &out, const LoadCompletedEvent &event) { out << event.Dump(); return out; } diff --git a/cpp/src/scheduler/event/CopyCompletedEvent.h b/cpp/src/scheduler/event/LoadCompletedEvent.h similarity index 69% rename from cpp/src/scheduler/event/CopyCompletedEvent.h rename to cpp/src/scheduler/event/LoadCompletedEvent.h index d2f5ddb0..c59b6256 100644 --- a/cpp/src/scheduler/event/CopyCompletedEvent.h +++ b/cpp/src/scheduler/event/LoadCompletedEvent.h @@ -13,18 +13,18 @@ namespace zilliz { namespace milvus { namespace engine { -class CopyCompletedEvent : public Event { +class LoadCompletedEvent : public Event { public: - CopyCompletedEvent(std::weak_ptr resource, TaskTableItemPtr task_table_item) - : Event(EventType::COPY_COMPLETED, std::move(resource)), + LoadCompletedEvent(std::weak_ptr resource, TaskTableItemPtr task_table_item) + : Event(EventType::LOAD_COMPLETED, std::move(resource)), task_table_item_(std::move(task_table_item)) {} inline std::string Dump() const override { - return ""; + return ""; } - friend std::ostream &operator<<(std::ostream &out, const CopyCompletedEvent &event); + friend std::ostream &operator<<(std::ostream &out, const LoadCompletedEvent &event); public: TaskTableItemPtr task_table_item_; diff --git a/cpp/src/scheduler/resource/Resource.cpp b/cpp/src/scheduler/resource/Resource.cpp index 6789d00c..75c3b4d7 100644 --- a/cpp/src/scheduler/resource/Resource.cpp +++ b/cpp/src/scheduler/resource/Resource.cpp @@ -113,10 +113,9 @@ void Resource::loader_function() { break; } LoadFile(task_item->task); - // TODO: wrapper loaded task_item->Loaded(); if (subscriber_) { - auto event = std::make_shared(shared_from_this(), task_item); + auto event = std::make_shared(shared_from_this(), task_item); subscriber_(std::static_pointer_cast(event)); } } diff --git a/cpp/src/scheduler/resource/Resource.h b/cpp/src/scheduler/resource/Resource.h index 76c0b007..dcd5fb5d 100644 --- a/cpp/src/scheduler/resource/Resource.h +++ b/cpp/src/scheduler/resource/Resource.h @@ -14,7 +14,7 @@ #include "../event/Event.h" #include "../event/StartUpEvent.h" -#include "../event/CopyCompletedEvent.h" +#include "../event/LoadCompletedEvent.h" #include "../event/FinishTaskEvent.h" #include "../event/TaskTableUpdatedEvent.h" #include "../TaskTable.h" -- GitLab