-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #84 from SINTEF-9012/pipeline-improvements
Pipeline improvements
- Loading branch information
Showing
45 changed files
with
2,085 additions
and
898 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
103 changes: 103 additions & 0 deletions
103
backend/api/python_endpoints/similarity_pipeline_endpoints.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
from multiprocessing import Process | ||
from backend.knowledge_graph.dao.AnnotationNodesDao import AnnotationNodesDao | ||
from backend.knowledge_graph.dao.BaseNodesDao import BaseNodeDao | ||
from backend.knowledge_graph.dao.DatabaseConnectionsDao import DatabaseConnectionsDao | ||
from backend.knowledge_graph.dao.RuntimeConnectionsDao import RuntimeConnectionsDao | ||
from backend.runtime_connections.RuntimeConnectionContainer import ( | ||
RuntimeConnectionContainer, | ||
) | ||
from similarity_pipeline.similarity_pipeline_1_ts_feature_extraction import ( | ||
similarity_pipeline_1_ts_feature_extraction, | ||
) | ||
from similarity_pipeline.similarity_pipeline_2_ts_dimensionality_reduction import ( | ||
similarity_pipeline_2_ts_dimensionality_reduction, | ||
) | ||
from similarity_pipeline.similarity_pipeline_3_ts_clustering import ( | ||
similarity_pipeline_3_ts_clustering, | ||
) | ||
from similarity_pipeline.similarity_pipeline_4_text_key_phrase_extraction import ( | ||
similarity_pipeline_4_text_key_phrase_extraction, | ||
) | ||
from similarity_pipeline.similarity_pipeline_5_cad_analysis import similarity_pipeline_5_cad_analysis | ||
from similarity_pipeline.similarity_pipeline_6_image_analysis import similarity_pipeline_6_image_analysis | ||
from similarity_pipeline.similarity_pipeline_7_asset_similarity import similarity_pipeline_7_asset_similarity | ||
from similarity_pipeline.similarity_pipeline_status_manager import ( | ||
SimilarityPipelineStatusManager, | ||
) | ||
|
||
BASE_NODE_DAO: BaseNodeDao = BaseNodeDao.instance() | ||
ANNOTATIONS_DAO: AnnotationNodesDao = AnnotationNodesDao.instance() | ||
DB_CON_DAO: DatabaseConnectionsDao = DatabaseConnectionsDao.instance() | ||
RT_CON_DAO: RuntimeConnectionsDao = RuntimeConnectionsDao.instance() | ||
|
||
RT_CON_CONTAINER: RuntimeConnectionContainer = RuntimeConnectionContainer.instance() | ||
|
||
SIMILARITY_MANAGER = SimilarityPipelineStatusManager.instance() | ||
|
||
|
||
def get_pipeline_status(): | ||
"""Combined status endpoint. Should be preferred to use less API calls. | ||
Returns: | ||
_type_: dict | ||
""" | ||
|
||
return SIMILARITY_MANAGER.read_status() | ||
|
||
|
||
def post_time_series_feature_extraction(): | ||
SIMILARITY_MANAGER.set_active(active=True, stage="time_series_feature_extraction") | ||
pipeline_process: Process = Process( | ||
target=similarity_pipeline_1_ts_feature_extraction, | ||
) | ||
pipeline_process.start() | ||
|
||
|
||
def post_time_series_dimensionality_reduction(): | ||
SIMILARITY_MANAGER.set_active( | ||
active=True, stage="time_series_dimensionality_reduction" | ||
) | ||
pipeline_process: Process = Process( | ||
target=similarity_pipeline_2_ts_dimensionality_reduction, | ||
) | ||
pipeline_process.start() | ||
|
||
|
||
def post_time_series_clustering(): | ||
SIMILARITY_MANAGER.set_active(active=True, stage="time_series_clustering") | ||
pipeline_process: Process = Process( | ||
target=similarity_pipeline_3_ts_clustering, | ||
) | ||
pipeline_process.start() | ||
|
||
|
||
def post_text_keyphrase_extraction(): | ||
SIMILARITY_MANAGER.set_active(active=True, stage="text_keyphrase_extraction") | ||
pipeline_process: Process = Process( | ||
target=similarity_pipeline_4_text_key_phrase_extraction, | ||
) | ||
pipeline_process.start() | ||
|
||
|
||
def post_cad_analysis(): | ||
SIMILARITY_MANAGER.set_active(active=True, stage="cad_analysis") | ||
pipeline_process: Process = Process( | ||
target=similarity_pipeline_5_cad_analysis, | ||
) | ||
pipeline_process.start() | ||
|
||
|
||
def post_image_analysis(): | ||
SIMILARITY_MANAGER.set_active(active=True, stage="image_analysis") | ||
pipeline_process: Process = Process( | ||
target=similarity_pipeline_6_image_analysis, | ||
) | ||
pipeline_process.start() | ||
|
||
|
||
def post_asset_similarity(): | ||
SIMILARITY_MANAGER.set_active(active=True, stage="asset_similarity") | ||
pipeline_process: Process = Process( | ||
target=similarity_pipeline_7_asset_similarity, | ||
) | ||
pipeline_process.start() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
backend/api/rest_endpoints/similarity_pipeline_endpoints.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
from backend.api.api import app | ||
import backend.api.python_endpoints.similarity_pipeline_endpoints as similarity_pipeline_endpoints | ||
|
||
|
||
@app.get("/similarity_pipeline/status") | ||
async def get_pipeline_status(): | ||
"""Combined status endpoint for the similarity pipeline. | ||
Returns: | ||
_type_: json | ||
""" | ||
status_dict = similarity_pipeline_endpoints.get_pipeline_status() | ||
|
||
return status_dict | ||
|
||
|
||
@app.post("/similarity_pipeline/time_series_feature_extraction") | ||
async def post_time_series_feature_extraction(): | ||
similarity_pipeline_endpoints.post_time_series_feature_extraction() | ||
|
||
|
||
@app.post("/similarity_pipeline/time_series_dimensionality_reduction") | ||
async def post_time_series_dimensionality_reduction(): | ||
similarity_pipeline_endpoints.post_time_series_dimensionality_reduction() | ||
|
||
|
||
@app.post("/similarity_pipeline/time_series_clustering") | ||
async def post_time_series_clustering(): | ||
similarity_pipeline_endpoints.post_time_series_clustering() | ||
|
||
|
||
@app.post("/similarity_pipeline/text_keyphrase_extraction") | ||
async def post_text_keyphrase_extraction(): | ||
similarity_pipeline_endpoints.post_text_keyphrase_extraction() | ||
|
||
|
||
@app.post("/similarity_pipeline/cad_analysis") | ||
async def post_cad_analysis(): | ||
similarity_pipeline_endpoints.post_cad_analysis() | ||
|
||
|
||
@app.post("/similarity_pipeline/image_analysis") | ||
async def post_image_analysis(): | ||
similarity_pipeline_endpoints.post_image_analysis() | ||
|
||
|
||
@app.post("/similarity_pipeline/asset_similarity") | ||
async def post_asset_similarity(): | ||
similarity_pipeline_endpoints.post_asset_similarity() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.