Loading examples/demo4-ue/src/demo-server/backend/server/demo4_service.go +24 −9 Original line number Diff line number Diff line Loading @@ -1170,15 +1170,30 @@ func demo4DaiDoPingDELETE(w http.ResponseWriter, r *http.Request) { appActivityLogs = append(appActivityLogs, "demo4DaiDoPingDELETE: " + err.Error()) log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) return } // Send resp err := errors.New("Not implemented yet") appActivityLogs = append(appActivityLogs, "demo4DaiDoPingDELETE: " + err.Error()) log.Error(err.Error()) // Retrieve the appContextId var appContextId string for k := range appContexts { log.Debug("demo4DaiDoPingPOST: Set appContextId to ", k) appContextId = k } // End of 'for' statement log.Debug("demo4DaiDoPingDELETE: appContextId: ", appContextId) _/*resp*/, err := daiClient.DevAppApi.DevAppContextDELETE(context.TODO(), appContextId) if err != nil { err := errors.New("Failed to delete appContextId: " + appContextId) appActivityLogs = append(appActivityLogs, "demo4DaiDoPingDELETE: Failed to delete appContextId [" + err.Error() + "]") http.Error(w, err.Error(), http.StatusInternalServerError) return } // Remove it from appContexts delete(appContexts, appContextId) log.Debug("demo4DaiDoPingDELETE: Updated appContexts= ", appContexts) //w.WriteHeader(http.StatusNoContent) // Send resp w.WriteHeader(http.StatusNoContent) } // Rest API handle user-app termination call-back notification Loading go-packages/meep-dai-mgr/exec.go +6 −1 Original line number Diff line number Diff line Loading @@ -51,8 +51,13 @@ func cmdExec(cli string) (int, error) { return pid, nil } func terminatePidProcess(pid int) { str := "kill " + strconv.Itoa(pid) // SIGTERM _, _ = cmdExec(str) } func deletePidProcess(pid int) { str := "kill -9 " + strconv.Itoa(pid) str := "kill -9 " + strconv.Itoa(pid) // SIGKILL _, _ = cmdExec(str) } Loading go-packages/meep-dai-mgr/meep-dai-mgr.go +19 −10 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ package meepdaimgr import ( "database/sql" "os" //"encoding/json" "errors" //"sort" Loading Loading @@ -640,6 +641,17 @@ func (am *DaiMgr) DeleteAppContext(appContextId string) (err error) { return err } // TODO Add logic to delete applicationListAppList // Whe deleting the context, un-instantiate the application // TODO meep-dai-mgr could be partially enhanced with MEC-10-2 Clauses 6.2.1.2 Type: AppD and Lifecycle Mgmt // Un-instantiate the MEC application process pid, err := strconv.ParseInt(appContextId, 10, 64) // FIXME To be enhanced to get outputs if err != nil { return err } terminatePidProcess(int(pid)) log.Debug("Just terminated subprocess ", strconv.Itoa(int(pid))) result, err := am.db.Exec(`DELETE FROM `+AppContextTable+` WHERE contextId = ($1)`, appContextId) if err != nil { log.Error(err.Error()) Loading @@ -654,17 +666,14 @@ func (am *DaiMgr) DeleteAppContext(appContextId string) (err error) { return errors.New("ContextId not found") } // TODO Add logic to delete applicationListAppList // Whe deleting the context, un-instantiate the application // TODO meep-dai-mgr could be partially enhanced with MEC-10-2 Clauses 6.2.1.2 Type: AppD and Lifecycle Mgmt _, err = DockerTerminate(appContextId, 3*time.Second) // Notify listener am.notifyListener(appContextId) process, err := os.FindProcess(pid) if err != nil { log.Error(err.Error()) return err } // Notify listener am.notifyListener(appContextId) log.Debug("Process info: ", *process) if profiling { now := time.Now() Loading Loading @@ -1073,7 +1082,7 @@ func (am *DaiMgr) CreateAppContext(appContext *AppContext) (app *AppContext, err // TODO Add logic to instanciate applicationListAppList // Whe creating the context, instantiate the application pid, err := cmdExec(fullPathApp) pid, err := cmdExec(fullPathApp) // FIXME To be enhanced to get outputs if err != nil { log.Error(err.Error()) return nil, err Loading scripts/build_all.sh +10 −4 Original line number Diff line number Diff line Loading @@ -6,7 +6,8 @@ DESC="AdvantEDGE platform" TIMEOUT=7 IS_RUNNING=`kubectl get pods --all-namespaces | grep "meep-virt-engine" | awk '{print $2}'` ADV_PATH=~/AdvantEDGE BUILD_EX=$1 DO_NOT_BUILD_EX=$1 stop_advantedge() { if [ -n $IS_RUNNING ]; then meepctl delete core Loading @@ -21,7 +22,7 @@ build_advantedge() { meepctl deploy dep sleep $TIMEOUT rm -fr $ADV_PATH/bin/meep-* if [ "$BUILD_EX" = "-e" ]; then if [ "$DO_NOT_BUILD_EX" != "--noexamplesbuilt" ]; then build_examples fi meepctl build all --nolint Loading @@ -42,11 +43,16 @@ build_examples() { } usage() { echo "Usage: $0 {-e}" >&2 echo " -e To include building examples" echo "Usage: $0 [--noexamplesbuilt]" >&2 echo " --noexamplesbuilt: To exclude examples from build process (optional)" exit 1 } if [ "$DO_NOT_BUILD_EX" != "" ]; then if [ "$DO_NOT_BUILD_EX" != "--noexamplesbuilt" ]; then usage fi fi stop_advantedge sleep $TIMEOUT build_advantedge Loading Loading
examples/demo4-ue/src/demo-server/backend/server/demo4_service.go +24 −9 Original line number Diff line number Diff line Loading @@ -1170,15 +1170,30 @@ func demo4DaiDoPingDELETE(w http.ResponseWriter, r *http.Request) { appActivityLogs = append(appActivityLogs, "demo4DaiDoPingDELETE: " + err.Error()) log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) return } // Send resp err := errors.New("Not implemented yet") appActivityLogs = append(appActivityLogs, "demo4DaiDoPingDELETE: " + err.Error()) log.Error(err.Error()) // Retrieve the appContextId var appContextId string for k := range appContexts { log.Debug("demo4DaiDoPingPOST: Set appContextId to ", k) appContextId = k } // End of 'for' statement log.Debug("demo4DaiDoPingDELETE: appContextId: ", appContextId) _/*resp*/, err := daiClient.DevAppApi.DevAppContextDELETE(context.TODO(), appContextId) if err != nil { err := errors.New("Failed to delete appContextId: " + appContextId) appActivityLogs = append(appActivityLogs, "demo4DaiDoPingDELETE: Failed to delete appContextId [" + err.Error() + "]") http.Error(w, err.Error(), http.StatusInternalServerError) return } // Remove it from appContexts delete(appContexts, appContextId) log.Debug("demo4DaiDoPingDELETE: Updated appContexts= ", appContexts) //w.WriteHeader(http.StatusNoContent) // Send resp w.WriteHeader(http.StatusNoContent) } // Rest API handle user-app termination call-back notification Loading
go-packages/meep-dai-mgr/exec.go +6 −1 Original line number Diff line number Diff line Loading @@ -51,8 +51,13 @@ func cmdExec(cli string) (int, error) { return pid, nil } func terminatePidProcess(pid int) { str := "kill " + strconv.Itoa(pid) // SIGTERM _, _ = cmdExec(str) } func deletePidProcess(pid int) { str := "kill -9 " + strconv.Itoa(pid) str := "kill -9 " + strconv.Itoa(pid) // SIGKILL _, _ = cmdExec(str) } Loading
go-packages/meep-dai-mgr/meep-dai-mgr.go +19 −10 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ package meepdaimgr import ( "database/sql" "os" //"encoding/json" "errors" //"sort" Loading Loading @@ -640,6 +641,17 @@ func (am *DaiMgr) DeleteAppContext(appContextId string) (err error) { return err } // TODO Add logic to delete applicationListAppList // Whe deleting the context, un-instantiate the application // TODO meep-dai-mgr could be partially enhanced with MEC-10-2 Clauses 6.2.1.2 Type: AppD and Lifecycle Mgmt // Un-instantiate the MEC application process pid, err := strconv.ParseInt(appContextId, 10, 64) // FIXME To be enhanced to get outputs if err != nil { return err } terminatePidProcess(int(pid)) log.Debug("Just terminated subprocess ", strconv.Itoa(int(pid))) result, err := am.db.Exec(`DELETE FROM `+AppContextTable+` WHERE contextId = ($1)`, appContextId) if err != nil { log.Error(err.Error()) Loading @@ -654,17 +666,14 @@ func (am *DaiMgr) DeleteAppContext(appContextId string) (err error) { return errors.New("ContextId not found") } // TODO Add logic to delete applicationListAppList // Whe deleting the context, un-instantiate the application // TODO meep-dai-mgr could be partially enhanced with MEC-10-2 Clauses 6.2.1.2 Type: AppD and Lifecycle Mgmt _, err = DockerTerminate(appContextId, 3*time.Second) // Notify listener am.notifyListener(appContextId) process, err := os.FindProcess(pid) if err != nil { log.Error(err.Error()) return err } // Notify listener am.notifyListener(appContextId) log.Debug("Process info: ", *process) if profiling { now := time.Now() Loading Loading @@ -1073,7 +1082,7 @@ func (am *DaiMgr) CreateAppContext(appContext *AppContext) (app *AppContext, err // TODO Add logic to instanciate applicationListAppList // Whe creating the context, instantiate the application pid, err := cmdExec(fullPathApp) pid, err := cmdExec(fullPathApp) // FIXME To be enhanced to get outputs if err != nil { log.Error(err.Error()) return nil, err Loading
scripts/build_all.sh +10 −4 Original line number Diff line number Diff line Loading @@ -6,7 +6,8 @@ DESC="AdvantEDGE platform" TIMEOUT=7 IS_RUNNING=`kubectl get pods --all-namespaces | grep "meep-virt-engine" | awk '{print $2}'` ADV_PATH=~/AdvantEDGE BUILD_EX=$1 DO_NOT_BUILD_EX=$1 stop_advantedge() { if [ -n $IS_RUNNING ]; then meepctl delete core Loading @@ -21,7 +22,7 @@ build_advantedge() { meepctl deploy dep sleep $TIMEOUT rm -fr $ADV_PATH/bin/meep-* if [ "$BUILD_EX" = "-e" ]; then if [ "$DO_NOT_BUILD_EX" != "--noexamplesbuilt" ]; then build_examples fi meepctl build all --nolint Loading @@ -42,11 +43,16 @@ build_examples() { } usage() { echo "Usage: $0 {-e}" >&2 echo " -e To include building examples" echo "Usage: $0 [--noexamplesbuilt]" >&2 echo " --noexamplesbuilt: To exclude examples from build process (optional)" exit 1 } if [ "$DO_NOT_BUILD_EX" != "" ]; then if [ "$DO_NOT_BUILD_EX" != "--noexamplesbuilt" ]; then usage fi fi stop_advantedge sleep $TIMEOUT build_advantedge Loading