diff --git a/build-mongod.sh b/build-mongod.sh new file mode 100755 index 0000000..f521b70 --- /dev/null +++ b/build-mongod.sh @@ -0,0 +1,11 @@ +# !/bin/bash + +curl -fsSL https://www.mongodb.org/static/pgp/server-5.0.asc | \ + sudo gpg -o /usr/share/keyrings/mongodb-server-5.0.gpg \ + --dearmor +echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-5.0.gpg ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/5.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-5.0.list +sudo apt-get update +sudo apt-get install -y mongodb-org +sudo systemctl start mongod +sudo systemctl status mongod +sudo systemctl enable mongod diff --git a/controlplane/buildAndPush.sh b/controlplane/buildAndPush.sh index a9d4d41..2ce3c47 100755 --- a/controlplane/buildAndPush.sh +++ b/controlplane/buildAndPush.sh @@ -16,7 +16,7 @@ echo "Using $BUILD_CONTEXT as the build context" # Build the Docker image BUILD_LOG=$(mktemp) -docker build -t $IMAGE_NAME $BUILD_CONTEXT --progress=plain > $BUILD_LOG 2>&1 +docker build -t $IMAGE_NAME $BUILD_CONTEXT > $BUILD_LOG 2>&1 BUILD_EXIT_CODE=$? if [ $BUILD_EXIT_CODE -ne 0 ]; then diff --git a/controlplane/dag_specifications/noop5_dag.json b/controlplane/dag_specifications/noop5_dag.json new file mode 100644 index 0000000..e5715e1 --- /dev/null +++ b/controlplane/dag_specifications/noop5_dag.json @@ -0,0 +1,75 @@ +{ + "name":"noop5_dag", + "dag":[ + { + "node_id":"noop1", + "properties": + { + "label": "noop 1", + "primitive": "parallel", + "condition":{}, + "next": ["noop2","noop3"], + "branch_1": "", + "branch_2": "", + "arguments": {}, + "outputs_from":"" + } + }, + { + "node_id":"noop2", + "properties": + { + "label":"noop 2", + "primitive":"merging", + "condition":{}, + "next":["noop4"], + "branch_1":"", + "branch_2":"", + "arguments":"", + "outputs_from":["noop1"] + } + }, + { + "node_id":"noop3", + "properties": + { + "label":"noop 3", + "primitive":"merging", + "condition":{}, + "next":["noop4"], + "branch_1":"", + "branch_2":"", + "arguments":"", + "outputs_from":["noop1"] + } + }, + { + "node_id":"noop4", + "properties": + { + "label":"noop 4", + "primitive":"serial", + "condition":{}, + "next":["noop5"], + "branch_1":"", + "branch_2":"", + "arguments":"", + "outputs_from":["noop2","noop3"] + } + }, + { + "node_id":"noop5", + "properties": + { + "label":"noop 5", + "primitive":"serial", + "condition":{}, + "next":"", + "branch_1":"", + "branch_2":"", + "arguments":"", + "outputs_from":["noop4"] + } + } + ] +} \ No newline at end of file diff --git a/controlplane/invoke.sh b/controlplane/invoke.sh index fe2cebb..ba1ca6d 100755 --- a/controlplane/invoke.sh +++ b/controlplane/invoke.sh @@ -5,6 +5,6 @@ number=$2 cd /home/ubuntu/DAGit/function_modules/testaction python3 ../../controlplane/registrations/function_register.py test.py Dockerfile requirements.txt $actionname$number cd /home/ubuntu/DAGit/function_modules/$actionname -sudo /home/ubuntu/DAGit/controlplane/buildAndPush.sh $actionname-image 10.0.0.27:5000 -wsk -i action update $actionname$number --docker 10.0.0.27:5000/$actionname-image +sudo /home/ubuntu/DAGit/controlplane/buildAndPush.sh $actionname-image 10.0.0.62:5000 +wsk -i action update $actionname$number --docker 10.0.0.62:5000/$actionname-image #wsk -i action invoke noop --result \ No newline at end of file diff --git a/controlplane/orchestrator.py b/controlplane/orchestrator.py index 4d9e4aa..c56f01a 100644 --- a/controlplane/orchestrator.py +++ b/controlplane/orchestrator.py @@ -96,7 +96,7 @@ def handle_parallel(queue,redis,action_properties_mapping,parallel_action_list): return responses def create_redis_instance(): - r = redis.Redis(host="127.0.0.1", port=6380, db=2) + r = redis.Redis(host="127.0.0.1", port=6379, db=2) return r diff --git a/controlplane/register-noop5_dag.sh b/controlplane/register-noop5_dag.sh new file mode 100755 index 0000000..607f176 --- /dev/null +++ b/controlplane/register-noop5_dag.sh @@ -0,0 +1,10 @@ +# !/bin/bash + +#./invoke.sh noop 1 +./invoke.sh noop 2 +./invoke.sh noop 3 +./invoke.sh noop 4 +./invoke.sh noop 5 + +#python3 /home/ubuntu/DAGit/controlplane/registrations/dag_register.py /home/ubuntu/DAGit/controlplane/dag_specifications/noop5_dag.json +python3 /home/ubuntu/DAGit/controlplane/registrations/trigger_register.py /home/ubuntu/DAGit/controlplane/trigger_specifications/noop5_dag.json \ No newline at end of file diff --git a/controlplane/trigger_specifications/noop5_dag.json b/controlplane/trigger_specifications/noop5_dag.json new file mode 100644 index 0000000..c8326f3 --- /dev/null +++ b/controlplane/trigger_specifications/noop5_dag.json @@ -0,0 +1,6 @@ +{ + "trigger_name": "noop5_dag", + "type":"dag", + "dags": ["noop5_dag"], + "functions":"" +} \ No newline at end of file diff --git a/function_modules/noop/noop.c b/function_modules/noop/noop.c index 915e328..c4c0bbb 100644 --- a/function_modules/noop/noop.c +++ b/function_modules/noop/noop.c @@ -5,40 +5,6 @@ int main(int argc, char *argv[]) { - //char *str = "{\"__ow_body\": [{\"action_name\": \"/guest/noop2\", \"activation_id\": \"ae0b8d60759642d18b8d60759622d14c\", \"message\": \" hello world!\"}, {\"action_name\": \"/guest/noop3\", \"activation_id\": \"52b5d51af9bd40a0b5d51af9bd10a078\", \"message\": \" hello world!\"}], \"__ow_headers\": {\"accept\": \"*/*\", \"accept-encoding\": \"gzip, deflate\", \"content-type\": \"application/json\", \"host\": \"controllers\", \"user-agent\": \"python-requests/2.18.4\", \"x-forwarded-for\": \"172.17.0.1\", \"x-forwarded-host\": \"172.17.0.1\", \"x-forwarded-port\": \"8080\", \"x-forwarded-proto\": \"http\", \"x-forwarded-url\": \"http://172.17.0.1/api/23bc46b1-71f6-4ed5-8c54-816aa4f8c502/noop4-api/noop4-path\", \"x-real-ip\": \"172.17.0.1\", \"x-request-id\": \"fda5d48c51bbc97ee8602d3f2ab8d90a\"}, \"__ow_method\": \"post\", \"__ow_path\": \"\"}"; - char *str = argv[1]; - char *value = NULL ; - char *key = "action_name"; - char *perior_action[Perior_action_count]; - int perior_action_count=0; - char *start = strstr(str, key); - while (start) - { - start =start+ strlen(key) + 4; // 跳过键部分,指向值的开始 - char *end = strstr(start, ","); - //end +=2 ; // 查找值的结束引号 - int length = end - start; - value = (char *)malloc(length + 1); // +1 用于存储字符串结束符 - if (value == NULL) printf("Memory allocation failed\n"); - if (end) { - // 复制值到 value 中 - strncpy(value, start, length-1); - value[length] = '\0'; // 添加字符串结束符 - } - perior_action[perior_action_count]=value; - perior_action_count++; - start = strstr(end, key); - - } - printf ("argv1:%s\n",argv[1]); - - if (perior_action_count != 0) - {for (int i = 0; i < perior_action_count; i++) - {printf("perior action:%s\n",perior_action[i]); - free (perior_action[i]);} - } - - const char *actvation_id = getenv("__OW_ACTIVATION_ID"); const char *action = getenv("__OW_ACTION_NAME"); printf("{\"action_name\" : \"%s\", \"activation_id\":\"%s\",\"message\": \" hello world!\" }\n",action,actvation_id);