From 0eacbfaafc56674a79f5390ae3a3454682b9b37f Mon Sep 17 00:00:00 2001 From: njl <1012408214@qq.com> Date: Fri, 11 Oct 2024 16:01:12 +0800 Subject: [PATCH] =?UTF-8?q?=20=E8=A6=81=E6=8F=90=E4=BA=A4=E7=9A=84?= =?UTF-8?q?=E5=8F=98=E6=9B=B4=EF=BC=9A=20=09=E4=BF=AE=E6=94=B9=EF=BC=9A=20?= =?UTF-8?q?=20=20=20=20controlplane/orchestrator.py=20=09=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=EF=BC=9A=20=20=20=20=20function=5Fmodules/noop/Docker?= =?UTF-8?q?file=20=09=E4=BF=AE=E6=94=B9=EF=BC=9A=20=20=20=20=20function=5F?= =?UTF-8?q?modules/noop/noop.c=20=09=E4=BF=AE=E6=94=B9=EF=BC=9A=20=20=20?= =?UTF-8?q?=20=20function=5Fmodules/noop/test1.json?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controlplane/orchestrator.py | 5 +++-- function_modules/noop/Dockerfile | 2 +- function_modules/noop/noop.c | 5 +++-- function_modules/noop/test1.json | 4 ++-- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/controlplane/orchestrator.py b/controlplane/orchestrator.py index e21e97d..4d9e4aa 100644 --- a/controlplane/orchestrator.py +++ b/controlplane/orchestrator.py @@ -89,13 +89,14 @@ def handle_parallel(queue,redis,action_properties_mapping,parallel_action_list): for thread in thread_list: thread.join() # results = [] - action_properties_mapping[next_action]["arguments"] = responses + if(next_action!=""): + action_properties_mapping[next_action[0]]["arguments"] = responses # result=responses # responses=[] return responses def create_redis_instance(): - r = redis.Redis(host="127.0.0.1", port=6379, db=2) + r = redis.Redis(host="127.0.0.1", port=6380, db=2) return r diff --git a/function_modules/noop/Dockerfile b/function_modules/noop/Dockerfile index d225f0f..cb5356a 100644 --- a/function_modules/noop/Dockerfile +++ b/function_modules/noop/Dockerfile @@ -7,7 +7,7 @@ RUN apk update && apk add --no-cache gcc musl-dev ADD . /action # 编译 C 程序为 exec -RUN gcc /action/noop.c /action/cJSON.c -o /action/exec -lm +RUN gcc /action/noop.c -o /action/exec -lm # 使用 CMD 指令执行编译好的 C 程序 CMD ["/bin/bash", "-c", "cd /actionProxy && python -u actionproxy.py"] diff --git a/function_modules/noop/noop.c b/function_modules/noop/noop.c index dfd29b2..9b90225 100644 --- a/function_modules/noop/noop.c +++ b/function_modules/noop/noop.c @@ -1,8 +1,9 @@ #include +#include int main() { - - printf("{ \"message\": \" hello world!\" }\n"); + const char *env_var = getenv("__OW_ACTIVATION_ID"); + printf("{ \"activation_id\":\"%s\",\"message\": \" hello world!\" }\n",env_var); return 0; // 返回 0 表示程序成功 } diff --git a/function_modules/noop/test1.json b/function_modules/noop/test1.json index 988f6c3..88b200f 100644 --- a/function_modules/noop/test1.json +++ b/function_modules/noop/test1.json @@ -6,13 +6,13 @@ "properties": { "label": "noop 1", - "primitive": "parallet", + "primitive": "parallel", "condition":{}, "next": ["noop2","noop3"], "branch_1": "", "branch_2": "", "arguments": {}, - "outputs_from":[] + "outputs_from":"" } }, {