Changes to be committed:

new file:   build-mongod.sh
	modified:   controlplane/buildAndPush.sh
	new file:   controlplane/dag_specifications/noop5_dag.json
	modified:   controlplane/invoke.sh
	modified:   controlplane/orchestrator.py
	new file:   controlplane/register-noop5_dag.sh
	new file:   controlplane/trigger_specifications/noop5_dag.json
	modified:   function_modules/noop/noop.c
anubhav
njl 4 weeks ago
parent f9329ef9d0
commit a59885301c

@ -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

@ -16,7 +16,7 @@ echo "Using $BUILD_CONTEXT as the build context"
# Build the Docker image # Build the Docker image
BUILD_LOG=$(mktemp) 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=$? BUILD_EXIT_CODE=$?
if [ $BUILD_EXIT_CODE -ne 0 ]; then if [ $BUILD_EXIT_CODE -ne 0 ]; then

@ -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"]
}
}
]
}

@ -5,6 +5,6 @@ number=$2
cd /home/ubuntu/DAGit/function_modules/testaction cd /home/ubuntu/DAGit/function_modules/testaction
python3 ../../controlplane/registrations/function_register.py test.py Dockerfile requirements.txt $actionname$number python3 ../../controlplane/registrations/function_register.py test.py Dockerfile requirements.txt $actionname$number
cd /home/ubuntu/DAGit/function_modules/$actionname cd /home/ubuntu/DAGit/function_modules/$actionname
sudo /home/ubuntu/DAGit/controlplane/buildAndPush.sh $actionname-image 10.0.0.27:5000 sudo /home/ubuntu/DAGit/controlplane/buildAndPush.sh $actionname-image 10.0.0.62:5000
wsk -i action update $actionname$number --docker 10.0.0.27:5000/$actionname-image wsk -i action update $actionname$number --docker 10.0.0.62:5000/$actionname-image
#wsk -i action invoke noop --result #wsk -i action invoke noop --result

@ -96,7 +96,7 @@ def handle_parallel(queue,redis,action_properties_mapping,parallel_action_list):
return responses return responses
def create_redis_instance(): 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 return r

@ -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

@ -0,0 +1,6 @@
{
"trigger_name": "noop5_dag",
"type":"dag",
"dags": ["noop5_dag"],
"functions":""
}

@ -5,40 +5,6 @@
int main(int argc, char *argv[]) { 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 *actvation_id = getenv("__OW_ACTIVATION_ID");
const char *action = getenv("__OW_ACTION_NAME"); const char *action = getenv("__OW_ACTION_NAME");
printf("{\"action_name\" : \"%s\", \"activation_id\":\"%s\",\"message\": \" hello world!\" }\n",action,actvation_id); printf("{\"action_name\" : \"%s\", \"activation_id\":\"%s\",\"message\": \" hello world!\" }\n",action,actvation_id);

Loading…
Cancel
Save