feat: publically releasing scale worker (updated)
This commit is contained in:
@@ -32,9 +32,9 @@ import (
|
|||||||
uuid "github.com/satori/go.uuid"
|
uuid "github.com/satori/go.uuid"
|
||||||
|
|
||||||
//k8s deps
|
//k8s deps
|
||||||
appsv1 "k8s.io/api/apps/v1"
|
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
appsv1 "k8s.io/api/apps/v1"
|
||||||
"k8s.io/apimachinery/pkg/util/intstr"
|
"k8s.io/apimachinery/pkg/util/intstr"
|
||||||
"k8s.io/client-go/kubernetes"
|
"k8s.io/client-go/kubernetes"
|
||||||
)
|
)
|
||||||
@@ -138,6 +138,7 @@ func setWorkflowExecution(ctx context.Context, workflowExecution shuffle.Workflo
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
handleExecutionResult(workflowExecution)
|
handleExecutionResult(workflowExecution)
|
||||||
validated := shuffle.ValidateFinished(ctx, -1, workflowExecution)
|
validated := shuffle.ValidateFinished(ctx, -1, workflowExecution)
|
||||||
if validated {
|
if validated {
|
||||||
@@ -737,6 +738,7 @@ func deployApp(cli *dockerclient.Client, image string, identifier string, env []
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Max 10% CPU every second
|
// Max 10% CPU every second
|
||||||
//CPUShares: 128,
|
//CPUShares: 128,
|
||||||
//CPUQuota: 10000,
|
//CPUQuota: 10000,
|
||||||
@@ -2389,6 +2391,7 @@ func runWorkflowExecutionTransaction(ctx context.Context, attempts int64, workfl
|
|||||||
|
|
||||||
func sendSelfRequest(actionResult shuffle.ActionResult) {
|
func sendSelfRequest(actionResult shuffle.ActionResult) {
|
||||||
|
|
||||||
|
|
||||||
data, err := json.Marshal(actionResult)
|
data, err := json.Marshal(actionResult)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("[ERROR][%s] Shutting down (24): Failed to unmarshal data for backend: %s", actionResult.ExecutionId, err)
|
log.Printf("[ERROR][%s] Shutting down (24): Failed to unmarshal data for backend: %s", actionResult.ExecutionId, err)
|
||||||
@@ -2526,6 +2529,7 @@ func validateFinished(workflowExecution shuffle.WorkflowExecution) bool {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
log.Printf("[DEBUG][%s] Should send full result to %s", workflowExecution.ExecutionId, baseUrl)
|
log.Printf("[DEBUG][%s] Should send full result to %s", workflowExecution.ExecutionId, baseUrl)
|
||||||
|
|
||||||
//data = fmt.Sprintf(`{"execution_id": "%s", "authorization": "%s"}`, executionId, authorization)
|
//data = fmt.Sprintf(`{"execution_id": "%s", "authorization": "%s"}`, executionId, authorization)
|
||||||
@@ -2609,6 +2613,7 @@ func handleGetStreamResults(resp http.ResponseWriter, request *http.Request) {
|
|||||||
// GetLocalIP returns the non loopback local IP of the host
|
// GetLocalIP returns the non loopback local IP of the host
|
||||||
func getLocalIP() string {
|
func getLocalIP() string {
|
||||||
|
|
||||||
|
|
||||||
addrs, err := net.InterfaceAddrs()
|
addrs, err := net.InterfaceAddrs()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ""
|
return ""
|
||||||
@@ -2658,6 +2663,7 @@ func webserverSetup(workflowExecution shuffle.WorkflowExecution) net.Listener {
|
|||||||
|
|
||||||
log.Printf("[DEBUG] OLD HOSTNAME: %s", appCallbackUrl)
|
log.Printf("[DEBUG] OLD HOSTNAME: %s", appCallbackUrl)
|
||||||
|
|
||||||
|
|
||||||
port := listener.Addr().(*net.TCPAddr).Port
|
port := listener.Addr().(*net.TCPAddr).Port
|
||||||
// Set the port environment variable
|
// Set the port environment variable
|
||||||
os.Setenv("WORKER_PORT", fmt.Sprintf("%d", port))
|
os.Setenv("WORKER_PORT", fmt.Sprintf("%d", port))
|
||||||
@@ -2815,6 +2821,7 @@ func findActiveSwarmNodes(dockercli *dockerclient.Client) (int64, error) {
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Runs data discovery
|
// Runs data discovery
|
||||||
|
|
||||||
func sendAppRequest(ctx context.Context, incomingUrl, appName string, port int, action *shuffle.Action, workflowExecution *shuffle.WorkflowExecution) error {
|
func sendAppRequest(ctx context.Context, incomingUrl, appName string, port int, action *shuffle.Action, workflowExecution *shuffle.WorkflowExecution) error {
|
||||||
@@ -3244,6 +3251,7 @@ func main() {
|
|||||||
swarmConfig := os.Getenv("SHUFFLE_SWARM_CONFIG")
|
swarmConfig := os.Getenv("SHUFFLE_SWARM_CONFIG")
|
||||||
log.Printf("[INFO] Running with timezone %s and swarm config %#v", timezone, swarmConfig)
|
log.Printf("[INFO] Running with timezone %s and swarm config %#v", timezone, swarmConfig)
|
||||||
|
|
||||||
|
|
||||||
authorization := ""
|
authorization := ""
|
||||||
executionId := ""
|
executionId := ""
|
||||||
|
|
||||||
@@ -3585,6 +3593,7 @@ func runWebserver(listener net.Listener) {
|
|||||||
r.HandleFunc("/api/v1/run", handleRunExecution).Methods("POST", "OPTIONS")
|
r.HandleFunc("/api/v1/run", handleRunExecution).Methods("POST", "OPTIONS")
|
||||||
r.HandleFunc("/api/v1/download", handleDownloadImage).Methods("POST", "OPTIONS")
|
r.HandleFunc("/api/v1/download", handleDownloadImage).Methods("POST", "OPTIONS")
|
||||||
|
|
||||||
|
|
||||||
if strings.ToLower(os.Getenv("SHUFFLE_DEBUG_MEMORY")) == "true" {
|
if strings.ToLower(os.Getenv("SHUFFLE_DEBUG_MEMORY")) == "true" {
|
||||||
r.HandleFunc("/debug/pprof/", pprof.Index)
|
r.HandleFunc("/debug/pprof/", pprof.Index)
|
||||||
r.HandleFunc("/debug/pprof/heap", pprof.Handler("heap").ServeHTTP)
|
r.HandleFunc("/debug/pprof/heap", pprof.Handler("heap").ServeHTTP)
|
||||||
@@ -3602,6 +3611,7 @@ func runWebserver(listener net.Listener) {
|
|||||||
|
|
||||||
//log.Fatal(http.Serve(listener, nil))
|
//log.Fatal(http.Serve(listener, nil))
|
||||||
|
|
||||||
|
|
||||||
log.Printf("[DEBUG] NEW webserver setup")
|
log.Printf("[DEBUG] NEW webserver setup")
|
||||||
|
|
||||||
http.Handle("/", r)
|
http.Handle("/", r)
|
||||||
|
|||||||
Reference in New Issue
Block a user