Skip to content

Commit 48e8789

Browse files
authored
refactor: remove nydusify logic from backend (#235)
Signed-off-by: chlins <[email protected]>
1 parent 7faab7c commit 48e8789

File tree

12 files changed

+0
-393
lines changed

12 files changed

+0
-393
lines changed

cmd/attach.go

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ package cmd
1919
import (
2020
"context"
2121
"fmt"
22-
"time"
2322

24-
"github.com/briandowns/spinner"
2523
"github.com/spf13/cobra"
2624
"github.com/spf13/viper"
2725

@@ -80,21 +78,5 @@ func runAttach(ctx context.Context, filepath string) error {
8078

8179
fmt.Printf("Successfully attached model artifact: %s\n", attachConfig.Target)
8280

83-
// nydusify the model artifact if needed.
84-
if attachConfig.Nydusify {
85-
sp := spinner.New(spinner.CharSets[39], 100*time.Millisecond, spinner.WithSuffix("Nydusifying..."))
86-
sp.Start()
87-
defer sp.Stop()
88-
89-
nydusName, err := b.Nydusify(ctx, attachConfig.Target)
90-
if err != nil {
91-
err = fmt.Errorf("failed to nydusify %s: %w", attachConfig.Target, err)
92-
sp.FinalMSG = err.Error()
93-
return err
94-
}
95-
96-
sp.FinalMSG = fmt.Sprintf("Successfully nydusify model artifact: %s", nydusName)
97-
}
98-
9981
return nil
10082
}

cmd/build.go

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,9 @@ package cmd
1919
import (
2020
"context"
2121
"fmt"
22-
"time"
2322

2423
"github.com/CloudNativeAI/modctl/pkg/backend"
2524
"github.com/CloudNativeAI/modctl/pkg/config"
26-
"github.com/briandowns/spinner"
2725

2826
"github.com/spf13/cobra"
2927
"github.com/spf13/viper"
@@ -82,21 +80,5 @@ func runBuild(ctx context.Context, workDir string) error {
8280

8381
fmt.Printf("Successfully built model artifact: %s\n", buildConfig.Target)
8482

85-
// nydusify the model artifact if needed.
86-
if buildConfig.Nydusify {
87-
sp := spinner.New(spinner.CharSets[39], 100*time.Millisecond, spinner.WithSuffix("Nydusifying..."))
88-
sp.Start()
89-
defer sp.Stop()
90-
91-
nydusName, err := b.Nydusify(ctx, buildConfig.Target)
92-
if err != nil {
93-
err = fmt.Errorf("failed to nydusify %s: %w", buildConfig.Target, err)
94-
sp.FinalMSG = err.Error()
95-
return err
96-
}
97-
98-
sp.FinalMSG = fmt.Sprintf("Successfully nydusify model artifact: %s", nydusName)
99-
}
100-
10183
return nil
10284
}

cmd/push.go

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,10 @@ package cmd
1919
import (
2020
"context"
2121
"fmt"
22-
"time"
2322

2423
"github.com/CloudNativeAI/modctl/pkg/backend"
2524
"github.com/CloudNativeAI/modctl/pkg/config"
2625

27-
"github.com/briandowns/spinner"
2826
"github.com/spf13/cobra"
2927
"github.com/spf13/viper"
3028
)
@@ -75,21 +73,5 @@ func runPush(ctx context.Context, target string) error {
7573

7674
fmt.Printf("Successfully pushed model artifact: %s\n", target)
7775

78-
// nydusify the model artifact if needed.
79-
if pushConfig.Nydusify {
80-
sp := spinner.New(spinner.CharSets[39], 100*time.Millisecond, spinner.WithSuffix("Nydusifying..."))
81-
sp.Start()
82-
defer sp.Stop()
83-
84-
nydusName, err := b.Nydusify(ctx, target)
85-
if err != nil {
86-
err = fmt.Errorf("failed to nydusify %s: %w", target, err)
87-
sp.FinalMSG = err.Error()
88-
return err
89-
}
90-
91-
sp.FinalMSG = fmt.Sprintf("Successfully nydusify model artifact: %s", nydusName)
92-
}
93-
9476
return nil
9577
}

go.mod

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ require (
77
github.com/CloudNativeAI/model-spec v0.0.6
88
github.com/antgroup/hugescm v0.18.3
99
github.com/avast/retry-go/v4 v4.6.1
10-
github.com/briandowns/spinner v1.23.2
1110
github.com/distribution/distribution/v3 v3.0.0
1211
github.com/distribution/reference v0.6.0
1312
github.com/dustin/go-humanize v1.0.1
@@ -46,7 +45,6 @@ require (
4645
github.com/dgraph-io/ristretto/v2 v2.2.0 // indirect
4746
github.com/docker/go-metrics v0.0.1 // indirect
4847
github.com/envoyproxy/protoc-gen-validate v1.2.1 // indirect
49-
github.com/fatih/color v1.7.0 // indirect
5048
github.com/fsnotify/fsnotify v1.8.0 // indirect
5149
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
5250
github.com/go-git/go-billy/v5 v5.6.2 // indirect

go.sum

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24
3131
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
3232
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
3333
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
34-
github.com/briandowns/spinner v1.23.2 h1:Zc6ecUnI+YzLmJniCfDNaMbW0Wid1d5+qcTq4L2FW8w=
35-
github.com/briandowns/spinner v1.23.2/go.mod h1:LaZeM4wm2Ywy6vO571mvhQNRcWfRUnXOs0RcKV0wYKM=
3634
github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8=
3735
github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
3836
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
@@ -68,8 +66,6 @@ github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc
6866
github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ=
6967
github.com/envoyproxy/protoc-gen-validate v1.2.1 h1:DEo3O99U8j4hBFwbJfrz9VtgcDfUKS7KJ7spH3d86P8=
7068
github.com/envoyproxy/protoc-gen-validate v1.2.1/go.mod h1:d/C80l/jxXLdfEIhX1W2TmLfsJ31lvEjwamM4DxlWXU=
71-
github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys=
72-
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
7369
github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=
7470
github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
7571
github.com/fsnotify/fsnotify v1.8.0 h1:dAwr6QBTBZIkG8roQaJjGof0pp0EeF+tNV7YBP3F/8M=

pkg/backend/attach.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ import (
3535
"github.com/CloudNativeAI/modctl/pkg/backend/build"
3636
buildconfig "github.com/CloudNativeAI/modctl/pkg/backend/build/config"
3737
"github.com/CloudNativeAI/modctl/pkg/backend/build/hooks"
38-
"github.com/CloudNativeAI/modctl/pkg/backend/build/interceptor"
3938
"github.com/CloudNativeAI/modctl/pkg/backend/processor"
4039
"github.com/CloudNativeAI/modctl/pkg/backend/remote"
4140
"github.com/CloudNativeAI/modctl/pkg/config"
@@ -349,9 +348,6 @@ func (b *backend) getBuilder(reference string, cfg *config.Attach) (build.Builde
349348
build.WithPlainHTTP(cfg.PlainHTTP),
350349
build.WithInsecure(cfg.Insecure),
351350
}
352-
if cfg.Nydusify {
353-
opts = append(opts, build.WithInterceptor(interceptor.NewNydus()))
354-
}
355351

356352
builder, err := build.NewBuilder(outputType, b.store, repo, tag, opts...)
357353
if err != nil {

pkg/backend/backend.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,6 @@ type Backend interface {
6666

6767
// Tag creates a new tag that refers to the source model artifact.
6868
Tag(ctx context.Context, source, target string) error
69-
70-
// Nydusify converts the model artifact to nydus format.
71-
Nydusify(ctx context.Context, target string) (string, error)
7269
}
7370

7471
// backend is the implementation of Backend.

pkg/backend/build.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ import (
3232
"github.com/CloudNativeAI/modctl/pkg/backend/build"
3333
buildconfig "github.com/CloudNativeAI/modctl/pkg/backend/build/config"
3434
"github.com/CloudNativeAI/modctl/pkg/backend/build/hooks"
35-
"github.com/CloudNativeAI/modctl/pkg/backend/build/interceptor"
3635
"github.com/CloudNativeAI/modctl/pkg/backend/processor"
3736
"github.com/CloudNativeAI/modctl/pkg/config"
3837
"github.com/CloudNativeAI/modctl/pkg/modelfile"
@@ -78,9 +77,6 @@ func (b *backend) Build(ctx context.Context, modelfilePath, workDir, target stri
7877
build.WithPlainHTTP(cfg.PlainHTTP),
7978
build.WithInsecure(cfg.Insecure),
8079
}
81-
if cfg.Nydusify {
82-
opts = append(opts, build.WithInterceptor(interceptor.NewNydus()))
83-
}
8480

8581
builder, err := build.NewBuilder(outputType, b.store, repo, tag, opts...)
8682
if err != nil {

pkg/backend/build/interceptor/nydus.go

Lines changed: 0 additions & 181 deletions
This file was deleted.

pkg/backend/build/interceptor/nydus_test.go

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)