Skip to content

Commit

Permalink
Merge pull request #149 from JimmyYang20/refector-lc
Browse files Browse the repository at this point in the history
lc: decouple all features into independent package
  • Loading branch information
kubeedge-bot authored Aug 6, 2021
2 parents 57be75c + 44609f0 commit e6c51fd
Show file tree
Hide file tree
Showing 13 changed files with 473 additions and 418 deletions.
22 changes: 14 additions & 8 deletions cmd/sedna-lc/app/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,13 @@ import (
"github.com/kubeedge/sedna/cmd/sedna-lc/app/options"
"github.com/kubeedge/sedna/pkg/localcontroller/common/constants"
"github.com/kubeedge/sedna/pkg/localcontroller/gmclient"
"github.com/kubeedge/sedna/pkg/localcontroller/manager"
"github.com/kubeedge/sedna/pkg/localcontroller/managers"
"github.com/kubeedge/sedna/pkg/localcontroller/managers/dataset"
"github.com/kubeedge/sedna/pkg/localcontroller/managers/federatedlearning"
"github.com/kubeedge/sedna/pkg/localcontroller/managers/incrementallearning"
"github.com/kubeedge/sedna/pkg/localcontroller/managers/jointinference"
"github.com/kubeedge/sedna/pkg/localcontroller/managers/lifelonglearning"
"github.com/kubeedge/sedna/pkg/localcontroller/managers/model"
"github.com/kubeedge/sedna/pkg/localcontroller/server"
"github.com/kubeedge/sedna/pkg/version/verflag"
)
Expand Down Expand Up @@ -86,21 +92,21 @@ func runServer() {
return
}

dm := manager.NewDatasetManager(c, Options)
dm := dataset.New(c, Options)

mm := manager.NewModelManager(c)
mm := model.New(c)

jm := manager.NewJointInferenceManager(c)
jm := jointinference.New(c)

fm := manager.NewFederatedLearningManager(c)
fm := federatedlearning.New(c)

im := manager.NewIncrementalJobManager(c, dm, mm, Options)
im := incrementallearning.New(c, dm, mm, Options)

lm := manager.NewLifelongLearningJobManager(c, dm, mm, Options)
lm := lifelonglearning.New(c, dm, Options)

s := server.New(Options)

for _, m := range []manager.FeatureManager{
for _, m := range []managers.FeatureManager{
dm, mm, jm, fm, im, lm,
} {
s.AddFeatureManager(m)
Expand Down
37 changes: 30 additions & 7 deletions pkg/localcontroller/gmclient/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ limitations under the License.

package gmclient

import messagetypes "github.com/kubeedge/sedna/pkg/globalmanager/messagelayer/model"

const (
// InsertOperation is the insert value
InsertOperation = "insert"
Expand All @@ -25,18 +27,39 @@ const (
StatusOperation = "status"
)

// Message defines message
// Message defines message between LC and GM
type Message struct {
Header MessageHeader `json:"header"`
Content []byte `json:"content"`
}

// MessageHeader define header of message
type MessageHeader struct {
Namespace string `json:"namespace"`
ResourceKind string `json:"resourceKind"`
ResourceName string `json:"resourceName"`
Operation string `json:"operation"`
// MessageHeader defines the header between LC and GM
type MessageHeader = messagetypes.MessageHeader

// UpstreamMessage defines send message content to GM
type UpstreamMessage struct {
Phase string `json:"phase"`
Status string `json:"status"`
Input *Input `json:"input,omitempty"`
Output *Output `json:"output"`
}

type Model struct {
Format string `json:"format"`
URL string `json:"url"`
Metrics map[string]interface{} `json:"metrics,omitempty"`
}

type Input struct {
Models []Model `json:"models,omitempty"`
DataURL string `json:"dataURL,omitempty"`
DataIndexURL string `json:"dataIndexURL,omitempty"`
OutputDir string `json:"outputDir,omitempty"`
}

type Output struct {
Models []map[string]interface{} `json:"models"`
OwnerInfo map[string]interface{} `json:"ownerInfo"`
}

type MessageResourceHandler interface {
Expand Down
120 changes: 0 additions & 120 deletions pkg/localcontroller/manager/types.go

This file was deleted.

Loading

0 comments on commit e6c51fd

Please sign in to comment.