1919from submodules .model .models import Attribute
2020from submodules .s3 import controller as s3
2121from util import daemon , notification
22+ from controller .knowledge_base import util as knowledge_base
2223
2324client = docker .from_env ()
2425image = os .getenv ("AC_EXEC_ENV_IMAGE" )
@@ -83,6 +84,7 @@ def run_attribute_calculation_exec_env(
8384
8485 prefixed_function_name = f"{ attribute_id } _fn"
8586 prefixed_payload = f"{ attribute_id } _payload.json"
87+ prefixed_knowledge_base = f"{ attribute_id } _knowledge"
8688 project_item = project .get (project_id )
8789 org_id = str (project_item .organization_id )
8890
@@ -91,9 +93,15 @@ def run_attribute_calculation_exec_env(
9193 project_id + "/" + prefixed_function_name ,
9294 attribute_item .source_code ,
9395 )
96+ s3 .put_object (
97+ org_id ,
98+ project_id + "/" + prefixed_knowledge_base ,
99+ knowledge_base .build_knowledge_base_from_project (project_id ),
100+ )
94101 command = [
95102 s3 .create_access_link (org_id , project_id + "/" + doc_bin ),
96103 s3 .create_access_link (org_id , project_id + "/" + prefixed_function_name ),
104+ s3 .create_access_link (org_id , project_id + "/" + prefixed_knowledge_base ),
97105 project_item .tokenizer_blank ,
98106 s3 .create_file_upload_link (org_id , project_id + "/" + prefixed_payload ),
99107 attribute_item .data_type ,
@@ -170,7 +178,6 @@ def read_container_logs_thread(
170178 attribute_id : str ,
171179 docker_container : Any ,
172180) -> None :
173-
174181 ctx_token = general .get_ctx_token ()
175182 # needs to be refetched since it is not thread safe
176183 attribute_item = attribute .get (project_id , attribute_id )
0 commit comments