Ray operator: controller code and guide to use (#6501)

This commit is contained in:
Qstar
2019-12-29 10:14:47 -06:00
committed by Edward Oakes
parent 7c1e0e5715
commit 10338fde0c
17 changed files with 1424 additions and 59 deletions
@@ -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)
}