Skip to content

Commit be792f9

Browse files
committed
refactor: remove nydusify logic from backend
Signed-off-by: chlins <[email protected]>
1 parent 7faab7c commit be792f9

File tree

10 files changed

+0
-387
lines changed

10 files changed

+0
-387
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
}

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)