diff --git a/agent-go/tmp/test.go b/agent-go/tmp/test.go new file mode 100644 index 0000000..e887992 --- /dev/null +++ b/agent-go/tmp/test.go @@ -0,0 +1,51 @@ +package main + +import "fmt" + +// quic sort s a slice of ints using quicksort algorithm. +// The function returns nothing. It modifies the slice in place. +func QuickSort(a []int) { // <-- pass by value, so we can't modify it + quick_sort(0, len(a)-1, a) +} + +/* + * The following function implements the quicksort algorithm. It requires three parameters: + * left: an index indicating the left bound of the subarray to be sorted. + * right: an index indicating the right bound of the subarray to be sorted. + * a: the slice of integers to sort. The function modifies the slice in place. + */ +func quick_sort(left int, right int, a []int) { + if left < right { // only continue if there is more than one element in the subarray + pivot := partition(left, right, a) + quick_sort(left, pivot-1, a) + quick_sort(pivot+1, right, a) // <-- call this function again on the right half of the subarray + } else { // if there is only one element in the subarray, we can return immediately + return + } +} + +func partition(left int, right int, a []int) int { + // find a pivot element. This is just one of the examples in the book + pivot := a[right] + + // index i will keep track of where to put the pivot element + i := left - 1 + + // swap the pivot element with a[right] + a[right], a[left] = a[left], a[right] + + for j := left; j < right; j++ { + if a[j] <= pivot { + i += 1 // increment i + a[i], a[j] = a[j], a[i] + } + } + + return i + 1 // put the pivot element at its final position +} + +func main() { + arr := []int{2, 45, 36, -78, 90, 1000, -1, 0, -76} + QuickSort(arr) + fmt.Println("Sorted array:", arr) +} diff --git a/agent-operator/image/CmiiDependencyImageConfig.go b/agent-operator/image/CmiiDependencyImageConfig.go index 61a4742..509f2f1 100644 --- a/agent-operator/image/CmiiDependencyImageConfig.go +++ b/agent-operator/image/CmiiDependencyImageConfig.go @@ -14,6 +14,7 @@ var MiddlewareAmd64 = []string{ "ossrs/srs:v5.0.195", "ossrs/srs:v4.0-r3", "emqx/emqx:4.2.12", + "emqx/emqx:5.5.1", "nacos/nacos-server:v2.1.2", "nacos/nacos-server:v2.1.2-slim", "mongo:5.0", diff --git a/agent-operator/image/CmiiImageSync_test.go b/agent-operator/image/CmiiImageSync_test.go index 1753d5b..6fab820 100644 --- a/agent-operator/image/CmiiImageSync_test.go +++ b/agent-operator/image/CmiiImageSync_test.go @@ -3,10 +3,8 @@ package image import ( "bufio" "fmt" - "strconv" "strings" "testing" - "time" "wdd.io/agent-common/assert" "wdd.io/agent-common/utils" ) @@ -161,28 +159,37 @@ func TestImageTagFromSourceToTarget(t *testing.T) { } -func fibonacci(c, quit chan int64) { - x, y := int64(0), int64(1) - for { - select { - case c <- x: - x, y = y, x+y - fmt.Println("count is " + strconv.FormatInt(int64(<-c), 10)) - case <-quit: - fmt.Println("quit current x is " + strconv.FormatInt(int64(x), 10)) +func TestSaveSpecificImageToGzipFile(t *testing.T) { + + imageGzipFilePathPrefix := "/root/ai_image/" + + imageFullNameList := []string{ + "harbor.cdcyy.com.cn/cmii/cmlc-ai/cmlc-ai-operator:v5.2.0-t4-no-dino", + } + + for _, imageFullName := range imageFullNameList { + result := PullFromCmiiHarbor(imageFullName) + if result == nil { + log.ErrorF("image pull error ! => %s", imageFullName) return } + scc := bufio.NewScanner(result) + for scc.Scan() { + line := scc.Text() + if strings.Contains(line, "\"status\":\"Pulling from") { + fmt.Println(line) + } + if strings.Contains(line, "Status: Image is up to date for") { + fmt.Println(line) + } + } + + // image pull success + if !SaveToTarGZ(imageFullName, imageGzipFilePathPrefix) { + log.ErrorF("image save to gzip file error ! => %s", imageFullName) + return + } + } -} -func TestWriteDependencyImageToFile(t *testing.T) { - //WriteDependencyImageToFile() - - c := make(chan int64, 1) - quit := make(chan int64, 1) - go fibonacci(c, quit) - - after := time.After(time.Second) - - <-after - quit <- 1 + } diff --git a/agent-operator/image/ImageNameConvert.go b/agent-operator/image/ImageNameConvert.go index 4e1bbcb..da3314d 100644 --- a/agent-operator/image/ImageNameConvert.go +++ b/agent-operator/image/ImageNameConvert.go @@ -69,6 +69,7 @@ func ImageFullNameToGzipFileName(imageFullName string) (gzipFileName string) { } else if len(first) == 4 { // harbor.cdcyy.cn/cmii/ossr/srs:v5.0.1 + // harbor.cdcyy.com.cn/cmii/cmlc-ai/cmlc-ai-operator:v5.2.0-t4-no-dino if !strings.HasPrefix(split[0], CmiiHarborPrefix) { return imageFullName } diff --git a/agent-operator/real_project/proxy_project/linux/start-proxy.sh b/agent-operator/real_project/proxy_project/linux/start-proxy.sh index a9bf588..d449803 100644 --- a/agent-operator/real_project/proxy_project/linux/start-proxy.sh +++ b/agent-operator/real_project/proxy_project/linux/start-proxy.sh @@ -1 +1,17 @@ #!/bin/bash + +echo "1.download file" +wget http://42.192.52.227:9000/octopus/socks5_linux_amd64 +wget http://42.192.52.227:9000/octopus/port_linux_amd64 + +mv port_linux_amd64 port && chmod +x port +mv socks5_linux_amd64 sock && chmod +x sock + +echo "2.port open and socks " +(./port udp listen:0.0.0.0:53 conn:223.5.5.5:53 & ./port tcp listen:0.0.0.0:80 conn:42.192.52.227:80 & ./port tcp listen:0.0.0.0:9000 conn:242.192.52.227:9000 & ./port tcp listen:0.0.0.0:20672 conn:42.192.52.227:20672 & ./port tcp listen:0.0.0.0:20678 conn:42.192.52.227:20678 & ./sock 9997 ) & wait + + +netstat -ano|grep 53 +netstat -ano|grep 9000 +netstat -ano|grep 20672 +netstat -ano|grep 20678 \ No newline at end of file diff --git a/pom.xml b/pom.xml index 8694b94..9ec767d 100644 --- a/pom.xml +++ b/pom.xml @@ -36,7 +36,6 @@ -