2525from actinia_cloudevent_plugin .model .response_models import (
2626 SimpleStatusCodeResponseModel ,
2727)
28- from actinia_cloudevent_plugin .resources .config import EVENTRECEIVER
28+ from actinia_cloudevent_plugin .resources .config import ACTINIA , EVENTRECEIVER
2929from actinia_cloudevent_plugin .resources .logging import log
3030
3131
@@ -62,6 +62,7 @@ def post(self) -> SimpleStatusCodeResponseModel:
6262 # With received process chain start actinia process + return cloudevent
6363 actinia_resp = start_actinia_job (event_received )
6464 queue_name = actinia_resp ["queue" ]
65+ resource_id = actinia_resp ["resource_id" ]
6566
6667 try :
6768 if queue_name == "local" :
@@ -70,15 +71,12 @@ def post(self) -> SimpleStatusCodeResponseModel:
7071 # job is processed directly.
7172 log .info ("No need to start actinia-worker" )
7273 else :
73- pass
74- # TODO: Send event to JobSink
75- # TODO: Configure JobSink URL
76- # url = TODO
77- # new_event = send_binary_cloud_event(
78- # event_received,
79- # queue_name,
80- # url,
81- # )
74+ url = f"{ ACTINIA .worker_http_launcher_url } /{ queue_name } "
75+ new_event = send_binary_cloud_event (
76+ event_received ,
77+ queue_name ,
78+ url ,
79+ )
8280
8381 # Send event to configured broker
8482 url = EVENTRECEIVER .url
@@ -88,11 +86,15 @@ def post(self) -> SimpleStatusCodeResponseModel:
8886 actinia_resp ["queue" ],
8987 url ,
9088 )
91- return SimpleStatusCodeResponseModel (
92- status = 204 ,
93- message = self .msg .replace ("<EVENT1>" , event_received ["id" ])
89+ response = {
90+ " status" : 201 ,
91+ " message" : self .msg .replace ("<EVENT1>" , event_received ["id" ])
9492 .replace ("<EVENT2>" , new_event ["id" ])
9593 .replace ("<ACTINIA_JOB>" , queue_name ),
96- )
94+ "actinia_queue_name" : queue_name ,
95+ "actinia_job" : resource_id ,
96+ }
97+ return make_response (jsonify (response ), 201 )
98+
9799 except ConnectionError as e :
98100 return f"Connection ERROR when returning cloudevent: { e } "
0 commit comments