Skip to content
This repository has been archived by the owner on Aug 24, 2023. It is now read-only.

Commit

Permalink
fix(model): adopt latest model structure (#7)
Browse files Browse the repository at this point in the history
Because

- removal of model instance concept in VDP

This commit

- adopt latest model structure
- cleanup unused modules
  • Loading branch information
heiruwu authored Apr 5, 2023
1 parent dba5512 commit d5c4264
Show file tree
Hide file tree
Showing 17 changed files with 118 additions and 1,727 deletions.
1 change: 0 additions & 1 deletion .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ jobs:
uses: actions/checkout@v3
with:
repository: instill-ai/vdp
ref: heiru/ins-374-add-newly-introduced-etcdcontroller-vdp

- name: Launch VDP
run: |
Expand Down
2 changes: 1 addition & 1 deletion config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ server:
corsorigins:
edition: local-ce:dev
disableusage: false
loopinterval: 5
loopinterval: 3
timeout: 120
debug: true
etcd:
Expand Down
24 changes: 2 additions & 22 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,14 @@ go 1.19

require (
cloud.google.com/go/longrunning v0.3.0
github.com/gofrs/uuid v4.3.1+incompatible
github.com/golang/mock v1.6.0
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0
github.com/grpc-ecosystem/grpc-gateway/v2 v2.14.0
github.com/instill-ai/model-backend v0.13.1-alpha
github.com/instill-ai/pipeline-backend v0.9.8-alpha
github.com/instill-ai/protogen-go v0.3.3-alpha.0.20230329021956-5f3a3104f4cb
github.com/instill-ai/x v0.2.0-alpha
github.com/instill-ai/protogen-go v0.3.3-alpha.0.20230402125221-c8f1a70b6b8b
github.com/knadh/koanf v1.5.0
github.com/redis/go-redis/v9 v9.0.2
github.com/rs/cors v1.8.2
github.com/stretchr/testify v1.8.1
go.einride.tech/aip v0.60.0
go.etcd.io/etcd/api/v3 v3.5.7
go.etcd.io/etcd/client/v3 v3.5.7
go.uber.org/zap v1.24.0
Expand All @@ -34,39 +29,24 @@ require (
github.com/coreos/go-systemd/v22 v22.3.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/facebookgo/clock v0.0.0-20150410010913-600d898af40a // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/go-redis/redis/v9 v9.0.0-rc.2 // indirect
github.com/go-sql-driver/mysql v1.7.0 // indirect
github.com/gogo/googleapis v1.4.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/gogo/status v1.1.1 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect
github.com/jackc/pgx/v5 v5.3.0 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.5 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/pborman/uuid v1.2.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/robfig/cron v1.2.0 // indirect
github.com/rogpeppe/go-internal v1.9.0 // indirect
github.com/santhosh-tekuri/jsonschema/v5 v5.1.1 // indirect
github.com/stretchr/objx v0.5.0 // indirect
go.etcd.io/etcd/client/pkg/v3 v3.5.7 // indirect
go.temporal.io/api v1.13.0 // indirect
go.temporal.io/sdk v1.19.0 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/multierr v1.9.0 // indirect
golang.org/x/crypto v0.6.0 // indirect
golang.org/x/sys v0.5.0 // indirect
golang.org/x/text v0.7.0 // indirect
golang.org/x/time v0.3.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
gorm.io/datatypes v1.1.0 // indirect
gorm.io/driver/mysql v1.4.4 // indirect
)
810 changes: 4 additions & 806 deletions go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion integration-test/const.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export const controllerPrivateHost = `${proto}://${ctHost}:${ctPrivatePort}`;
export const controllerGRPCPrivateHost = `${ctHost}:${ctPrivatePort}`;

export const modelResourceName = "resources/this-is-model-name/types/models"
export const modelName = "models/this-is/instances/model-name"
export const modelName = "models/model-name"

export const sourceConnectorResourceName = "resources/source-connector-name/types/source-connectors"
export const sourceConnectorName = "source-connectors/source-connector-name"
Expand Down
1 change: 0 additions & 1 deletion integration-test/proto/vdp/model/v1alpha/model.proto
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,6 @@ message WatchModelResponse {
// Retrieved model logrunning progress
int32 progress = 2;
}

////////////////////////////////////
// Trigger methods
////////////////////////////////////
Expand Down
10 changes: 6 additions & 4 deletions internal/util/const.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package util

const (
RESOURCE_TYPE_MODEL = "models"
RESOURCE_TYPE_SOURCE_CONNECTOR = "source-connectors"
RESOURCE_TYPE_MODEL = "models"
RESOURCE_TYPE_SOURCE_CONNECTOR = "source-connectors"
RESOURCE_TYPE_DESTINATION_CONNECTOR = "destination-connectors"
RESOURCE_TYPE_PIPELINE = "pipelines"
RESOURCE_TYPE_SERVICE = "services"
RESOURCE_TYPE_PIPELINE = "pipelines"
RESOURCE_TYPE_SERVICE = "services"
)

const DefaultPageSize = 10
24 changes: 4 additions & 20 deletions internal/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,10 @@ import (
"strings"
)

func ConvertModelToResourceName(modelInstanceName string) string {
splitName := strings.SplitN(modelInstanceName, "/", 4)
modelType, modelID, modelInstanceID := splitName[0], splitName[1], splitName[3]
resourceName := fmt.Sprintf("resources/%s-%s/types/%s", modelID, modelInstanceID, modelType)

return resourceName
}

func ConvertConnectorToResourceName(connectorName string) string {
splitName := strings.SplitN(connectorName, "/", 2)
connectorType, name := splitName[0], splitName[1]
resourceName := fmt.Sprintf("resources/%s/types/%s", name, connectorType)

return resourceName
}

func ConvertPipelineToResourceName(pipelineName string) string {
splitName := strings.SplitN(pipelineName, "/", 2)
pipelineType, name := splitName[0], splitName[1]
resourceName := fmt.Sprintf("resources/%s/types/%s", name, pipelineType)
func ConvertRequestToResourceName(requestName string) string {
splitName := strings.SplitN(requestName, "/", 2)
resourceType, name := splitName[0], splitName[1]
resourceName := fmt.Sprintf("resources/%s/types/%s", name, resourceType)

return resourceName
}
Expand Down
1 change: 0 additions & 1 deletion pkg/datamodel/datamodel.go

This file was deleted.

Loading

0 comments on commit d5c4264

Please sign in to comment.