Skip to content

Commit 89c98ad

Browse files
author
Normalnoise
authored
Merge pull request #208 from swanchain/fea-use-str-to-deploy
Add a (dockerfile or yaml) and multiple types of gpus to deploy jobs
2 parents f54056c + f256e9b commit 89c98ad

File tree

23 files changed

+1704
-444
lines changed

23 files changed

+1704
-444
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ spec:
298298
spec:
299299
containers:
300300
- name: resource-exporter
301-
image: filswan/resource-exporter:v11.3.2
301+
image: filswan/resource-exporter:v12.0.0
302302
imagePullPolicy: IfNotPresent
303303
securityContext:
304304
privileged: true
@@ -599,7 +599,7 @@ COMMANDS:
599599
changeOwnerAddress Update OwnerAddress of CP
600600
changeWorkerAddress Update workerAddress of CP
601601
changeBeneficiaryAddress Update beneficiaryAddress of CP
602-
changeTaskTypes Update taskTypes of CP (1:Fil-C2, 2:Mining, 3: AI, 4:Inference, 5:NodePort), separated by commas
602+
changeTaskTypes Update taskTypes of CP (1:Fil-C2, 2:Mining, 3: AI, 4:Inference, 5:NodePort, 100:Exit), separated by commas
603603
help, h Show a list of commands or help for one command
604604

605605
OPTIONS:

build/version.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@ const UBITaskImageIntelCpu = "filswan/ubi-worker-cpu-intel:latest"
1616
const UBITaskImageIntelGpu = "filswan/ubi-worker-gpu-intel:latest"
1717
const UBITaskImageAmdCpu = "filswan/ubi-worker-cpu-amd:latest"
1818
const UBITaskImageAmdGpu = "filswan/ubi-worker-gpu-amd:latest"
19-
const UBIResourceExporterDockerImage = "filswan/resource-exporter:v12.0.0-beta"
19+
const UBIResourceExporterDockerImage = "filswan/resource-exporter:v12.0.0"
2020
const TraefikServerDockerImage = "traefik:v2.10"
2121

22+
const ResourceExporterVersion = "v12.0.0"
23+
2224
func UserVersion() string {
2325
return BuildVersion + "+" + NetWorkTag + CurrentCommit
2426
}

cmd/computing-provider/run.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ var createAccountCmd = &cli.Command{
552552
},
553553
&cli.StringFlag{
554554
Name: "task-types",
555-
Usage: "Task types of CP (1:Fil-C2, 2:Mining, 3:AI, 4:Inference, 5:NodePort), separated by commas",
555+
Usage: "Task types of CP (1:Fil-C2, 2:Mining, 3:AI, 4:Inference, 5:NodePort, 100:Exit), separated by commas",
556556
},
557557
},
558558
Action: func(cctx *cli.Context) error {
@@ -856,7 +856,7 @@ var changeWorkerAddressCmd = &cli.Command{
856856

857857
var changeTaskTypesCmd = &cli.Command{
858858
Name: "changeTaskTypes",
859-
Usage: "Update taskTypes of CP (1:Fil-C2, 2:Mining, 3: AI, 4:Inference, 5:NodePort), separated by commas",
859+
Usage: "Update taskTypes of CP (1:Fil-C2, 2:Mining, 3: AI, 4:Inference, 5:NodePort, 100:Exit), separated by commas",
860860
ArgsUsage: "[TaskTypes]",
861861
Flags: []cli.Flag{
862862
&cli.StringFlag{

cmd/computing-provider/ubi.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"github.com/gin-gonic/gin"
99
cors "github.com/itsjamie/gin-cors"
1010
"github.com/olekukonko/tablewriter"
11+
"github.com/swanchain/go-computing-provider/build"
1112
"github.com/swanchain/go-computing-provider/conf"
1213
"github.com/swanchain/go-computing-provider/internal/computing"
1314
"github.com/swanchain/go-computing-provider/internal/models"
@@ -16,6 +17,7 @@ import (
1617
"os"
1718
"path/filepath"
1819
"strconv"
20+
"strings"
1921
"time"
2022
)
2123

@@ -165,19 +167,25 @@ var daemonCmd = &cli.Command{
165167
logs.GetLogger().Info("Starting a computing-provider client.")
166168
cpRepoPath, _ := os.LookupEnv("CP_PATH")
167169

170+
computing.NewDockerService().CleanResourceForDocker(true)
171+
168172
resourceExporterContainerName := "resource-exporter"
169-
rsExist, err := computing.NewDockerService().CheckRunningContainer(resourceExporterContainerName)
173+
rsExist, version, err := computing.NewDockerService().CheckRunningContainer(resourceExporterContainerName)
170174
if err != nil {
171175
return fmt.Errorf("check %s container failed, error: %v", resourceExporterContainerName, err)
172176
}
177+
if version != "" && !strings.Contains(version, build.ResourceExporterVersion) {
178+
logs.GetLogger().Fatalf("resource-exporter current version: %s too low, please upgrade the version to v12.0.0", version)
179+
}
180+
173181
if !rsExist {
174182
if err = computing.RestartResourceExporter(); err != nil {
175183
logs.GetLogger().Errorf("restartResourceExporter failed, error: %v", err)
176184
}
177185
}
178186

179187
traefikServiceContainerName := "traefik-service"
180-
tsExist, err := computing.NewDockerService().CheckRunningContainer(traefikServiceContainerName)
188+
tsExist, _, err := computing.NewDockerService().CheckRunningContainer(traefikServiceContainerName)
181189
if err != nil {
182190
return fmt.Errorf("check %s container failed, error: %v", traefikServiceContainerName, err)
183191
}
@@ -219,6 +227,7 @@ var daemonCmd = &cli.Command{
219227
router.GET("/cp/job/status", ecpImageService.GetJobStatus)
220228
router.GET("/cp/job/log", ecpImageService.DockerLogsHandler)
221229
router.DELETE("/cp/job/:job_uuid", ecpImageService.DeleteJob)
230+
router.POST("/cp/zk_task", computing.DoZkTask)
222231

223232
shutdownChan := make(chan struct{})
224233
httpStopper, err := util.ServeHttp(r, "cp-api", ":"+strconv.Itoa(conf.GetConfig().API.Port), false)

cmd/computing-provider/wallet.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,8 @@ var walletSend = &cli.Command{
284284
return fmt.Errorf("failed to parse target address: %s", to)
285285
}
286286

287+
nonce := cctx.Uint64("nonce")
288+
287289
amount := cctx.Args().Get(1)
288290
if strings.TrimSpace(amount) == "" {
289291
return fmt.Errorf("failed to get amount: %s", amount)
@@ -292,7 +294,7 @@ var walletSend = &cli.Command{
292294
if err != nil {
293295
return err
294296
}
295-
txHash, err := localWallet.WalletSend(ctx, from, to, amount)
297+
txHash, err := localWallet.WalletSend(ctx, from, to, amount, nonce)
296298
if err != nil {
297299
return err
298300
}

go.mod

Lines changed: 45 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ go 1.22.3
55
require (
66
github.com/BurntSushi/toml v1.3.2
77
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d
8-
github.com/containerd/containerd v1.7.20
9-
github.com/docker/docker v27.1.1+incompatible
8+
github.com/containerd/containerd v1.7.23
9+
github.com/docker/docker v27.5.0+incompatible
10+
github.com/docker/go-connections v0.5.0
1011
github.com/ethereum/go-ethereum v1.13.15
1112
github.com/fatih/color v1.13.0
1213
github.com/filswan/go-mcs-sdk v0.0.5
@@ -19,6 +20,7 @@ require (
1920
github.com/itsjamie/gin-cors v0.0.0-20220228161158-ef28d3d2a0a8
2021
github.com/joho/godotenv v1.3.0
2122
github.com/mitchellh/go-homedir v1.1.0
23+
github.com/moby/buildkit v0.19.0
2224
github.com/olekukonko/tablewriter v0.0.5
2325
github.com/projectcalico/api v0.0.0-20240708202104-e3f70b269c2c
2426
github.com/robfig/cron/v3 v3.0.0
@@ -35,10 +37,10 @@ require (
3537
)
3638

3739
require (
38-
github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24 // indirect
39-
github.com/AdamKorcz/go-118-fuzz-build v0.0.0-20230306123547-8075edf89bb0 // indirect
40+
github.com/AdaLogics/go-fuzz-headers v0.0.0-20240806141605-e8a1dd7889d6 // indirect
41+
github.com/AdamKorcz/go-118-fuzz-build v0.0.0-20231105174938-2b5cbb29f3e2 // indirect
4042
github.com/Microsoft/go-winio v0.6.2 // indirect
41-
github.com/Microsoft/hcsshim v0.11.7 // indirect
43+
github.com/Microsoft/hcsshim v0.12.9 // indirect
4244
github.com/StackExchange/wmi v1.2.1 // indirect
4345
github.com/benbjohnson/clock v1.3.0 // indirect
4446
github.com/bits-and-blooms/bitset v1.10.0 // indirect
@@ -48,29 +50,29 @@ require (
4850
github.com/codingsince1985/checksum v1.2.6 // indirect
4951
github.com/consensys/bavard v0.1.13 // indirect
5052
github.com/consensys/gnark-crypto v0.12.1 // indirect
51-
github.com/containerd/cgroups v1.1.0 // indirect
52-
github.com/containerd/containerd/api v1.7.19 // indirect
53-
github.com/containerd/continuity v0.4.2 // indirect
54-
github.com/containerd/errdefs v0.1.0 // indirect
53+
github.com/containerd/cgroups/v3 v3.0.3 // indirect
54+
github.com/containerd/containerd/api v1.8.0 // indirect
55+
github.com/containerd/continuity v0.4.5 // indirect
56+
github.com/containerd/errdefs v1.0.0 // indirect
57+
github.com/containerd/errdefs/pkg v0.3.0 // indirect
5558
github.com/containerd/fifo v1.1.0 // indirect
5659
github.com/containerd/log v0.1.0 // indirect
57-
github.com/containerd/platforms v0.2.1 // indirect
58-
github.com/containerd/ttrpc v1.2.5 // indirect
59-
github.com/containerd/typeurl/v2 v2.1.1 // indirect
60-
github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect
60+
github.com/containerd/platforms v1.0.0-rc.1 // indirect
61+
github.com/containerd/ttrpc v1.2.7 // indirect
62+
github.com/containerd/typeurl/v2 v2.2.3 // indirect
63+
github.com/cpuguy83/go-md2man/v2 v2.0.5 // indirect
6164
github.com/crackcomm/go-gitignore v0.0.0-20170627025303-887ab5e44cc3 // indirect
6265
github.com/crate-crypto/go-kzg-4844 v0.7.0 // indirect
6366
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
6467
github.com/deckarep/golang-set/v2 v2.1.0 // indirect
65-
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect
68+
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
6669
github.com/distribution/reference v0.6.0 // indirect
67-
github.com/docker/go-connections v0.4.0 // indirect
6870
github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c // indirect
6971
github.com/docker/go-units v0.5.0 // indirect
7072
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
7173
github.com/ethereum/c-kzg-4844 v0.4.0 // indirect
72-
github.com/felixge/httpsnoop v1.0.3 // indirect
73-
github.com/fsnotify/fsnotify v1.6.0 // indirect
74+
github.com/felixge/httpsnoop v1.0.4 // indirect
75+
github.com/fsnotify/fsnotify v1.7.0 // indirect
7476
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
7577
github.com/gabriel-vasile/mimetype v1.4.2 // indirect
7678
github.com/gin-contrib/sse v0.1.0 // indirect
@@ -101,7 +103,7 @@ require (
101103
github.com/jinzhu/now v1.1.5 // indirect
102104
github.com/josharian/intern v1.0.0 // indirect
103105
github.com/json-iterator/go v1.1.12 // indirect
104-
github.com/klauspost/compress v1.16.7 // indirect
106+
github.com/klauspost/compress v1.17.11 // indirect
105107
github.com/klauspost/cpuid/v2 v2.2.4 // indirect
106108
github.com/leodido/go-urn v1.2.4 // indirect
107109
github.com/libp2p/go-buffer-pool v0.1.0 // indirect
@@ -119,13 +121,13 @@ require (
119121
github.com/moby/docker-image-spec v1.3.1 // indirect
120122
github.com/moby/locker v1.0.1 // indirect
121123
github.com/moby/spdystream v0.4.0 // indirect
122-
github.com/moby/sys/mountinfo v0.6.2 // indirect
123-
github.com/moby/sys/sequential v0.5.0 // indirect
124-
github.com/moby/sys/signal v0.7.0 // indirect
125-
github.com/moby/sys/user v0.1.0 // indirect
124+
github.com/moby/sys/mountinfo v0.7.2 // indirect
125+
github.com/moby/sys/sequential v0.6.0 // indirect
126+
github.com/moby/sys/signal v0.7.1 // indirect
127+
github.com/moby/sys/user v0.3.0 // indirect
128+
github.com/moby/sys/userns v0.1.0 // indirect
126129
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
127130
github.com/modern-go/reflect2 v1.0.2 // indirect
128-
github.com/morikuni/aec v1.0.0 // indirect
129131
github.com/mr-tron/base58 v1.2.0 // indirect
130132
github.com/multiformats/go-base32 v0.1.0 // indirect
131133
github.com/multiformats/go-base36 v0.2.0 // indirect
@@ -138,10 +140,11 @@ require (
138140
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect
139141
github.com/opencontainers/go-digest v1.0.0 // indirect
140142
github.com/opencontainers/image-spec v1.1.0 // indirect
141-
github.com/opencontainers/runtime-spec v1.1.0 // indirect
142-
github.com/opencontainers/selinux v1.11.0 // indirect
143+
github.com/opencontainers/runtime-spec v1.2.0 // indirect
144+
github.com/opencontainers/selinux v1.11.1 // indirect
143145
github.com/pelletier/go-toml/v2 v2.0.8 // indirect
144146
github.com/pkg/errors v0.9.1 // indirect
147+
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect
145148
github.com/rifflock/lfshook v0.0.0-20180920164130-b9218ef580f5 // indirect
146149
github.com/rivo/uniseg v0.2.0 // indirect
147150
github.com/russross/blackfriday/v2 v2.1.0 // indirect
@@ -159,24 +162,24 @@ require (
159162
github.com/x448/float16 v0.8.4 // indirect
160163
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 // indirect
161164
go.opencensus.io v0.24.0 // indirect
162-
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.45.0 // indirect
163-
go.opentelemetry.io/otel v1.21.0 // indirect
164-
go.opentelemetry.io/otel/metric v1.21.0 // indirect
165-
go.opentelemetry.io/otel/trace v1.21.0 // indirect
165+
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0 // indirect
166+
go.opentelemetry.io/otel v1.31.0 // indirect
167+
go.opentelemetry.io/otel/metric v1.31.0 // indirect
168+
go.opentelemetry.io/otel/trace v1.31.0 // indirect
166169
golang.org/x/arch v0.3.0 // indirect
167-
golang.org/x/crypto v0.24.0 // indirect
168-
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa // indirect
169-
golang.org/x/net v0.26.0 // indirect
170-
golang.org/x/oauth2 v0.21.0 // indirect
171-
golang.org/x/sync v0.7.0 // indirect
172-
golang.org/x/sys v0.21.0 // indirect
173-
golang.org/x/term v0.21.0 // indirect
174-
golang.org/x/text v0.16.0 // indirect
175-
golang.org/x/time v0.3.0 // indirect
176-
google.golang.org/genproto v0.0.0-20231211222908-989df2bf70f3 // indirect
177-
google.golang.org/genproto/googleapis/rpc v0.0.0-20231212172506-995d672761c0 // indirect
178-
google.golang.org/grpc v1.59.0 // indirect
179-
google.golang.org/protobuf v1.34.2 // indirect
170+
golang.org/x/crypto v0.31.0 // indirect
171+
golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect
172+
golang.org/x/net v0.33.0 // indirect
173+
golang.org/x/oauth2 v0.23.0 // indirect
174+
golang.org/x/sync v0.10.0 // indirect
175+
golang.org/x/sys v0.28.0 // indirect
176+
golang.org/x/term v0.27.0 // indirect
177+
golang.org/x/text v0.21.0 // indirect
178+
golang.org/x/time v0.6.0 // indirect
179+
google.golang.org/genproto v0.0.0-20240123012728-ef4313101c80 // indirect
180+
google.golang.org/genproto/googleapis/rpc v0.0.0-20241021214115-324edc3d5d38 // indirect
181+
google.golang.org/grpc v1.68.1 // indirect
182+
google.golang.org/protobuf v1.35.2 // indirect
180183
gopkg.in/inf.v0 v0.9.1 // indirect
181184
gopkg.in/yaml.v3 v3.0.1 // indirect
182185
k8s.io/klog/v2 v2.130.1 // indirect

0 commit comments

Comments
 (0)