mirror of
https://github.com/wassname/ray.git
synced 2026-08-11 11:24:51 +08:00
Ray operator: controller code and guide to use (#6501)
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// IsCreated returns true if pod has been created and is maintained by the API server
|
||||
func IsCreated(pod *corev1.Pod) bool {
|
||||
return pod.Status.Phase != ""
|
||||
}
|
||||
|
||||
// Get substring before a string.
|
||||
func Before(value string, a string) string {
|
||||
pos := strings.Index(value, a)
|
||||
if pos == -1 {
|
||||
return ""
|
||||
}
|
||||
return value[0:pos]
|
||||
}
|
||||
|
||||
// FormatInt returns the string representation of i in the given base,
|
||||
// for 2 <= base <= 36. The result uses the lower-case letters 'a' to 'z'
|
||||
// for digit values >= 10.
|
||||
func FormatInt32(n int32) string {
|
||||
return strconv.FormatInt(int64(n), 10)
|
||||
}
|
||||
Reference in New Issue
Block a user