Skip to content

Commit d2c1647

Browse files
committed
add semaphore
1 parent b1db0bc commit d2c1647

2 files changed

Lines changed: 21 additions & 17 deletions

File tree

app/web/routers/webhooks.py

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -83,22 +83,26 @@ def run_transcription_ingestion_pipeline_worker(
8383
"""
8484
Run the transcription ingestion pipeline in a separate thread
8585
"""
86-
try:
87-
callback = TranscriptionIngestionStatus(
88-
run_id=dto.settings.authentication_token,
89-
base_url=dto.settings.artemis_base_url,
90-
initial_stages=dto.initial_stages,
91-
lecture_id=dto.lectureId,
92-
)
93-
db = VectorDatabase()
94-
client = db.get_client()
95-
pipeline = TranscriptionIngestionPipeline(
96-
client=client, dto=dto, callback=callback
97-
)
98-
pipeline()
99-
except Exception as e:
100-
logger.error(f"Error while deleting lectures: {e}")
101-
logger.error(traceback.format_exc())
86+
with semaphore:
87+
try:
88+
callback = TranscriptionIngestionStatus(
89+
run_id=dto.settings.authentication_token,
90+
base_url=dto.settings.artemis_base_url,
91+
initial_stages=dto.initial_stages,
92+
lecture_id=dto.lectureId
93+
)
94+
db = VectorDatabase()
95+
client = db.get_client()
96+
pipeline = TranscriptionIngestionPipeline(
97+
client=client, dto=dto, callback=callback
98+
)
99+
pipeline()
100+
except Exception as e:
101+
logger.error(f"Error while deleting lectures: {e}")
102+
logger.error(traceback.format_exc())
103+
capture_exception(e)
104+
finally:
105+
semaphore.release()
102106

103107

104108
def run_faq_update_pipeline_worker(dto: FaqIngestionPipelineExecutionDto):

app/web/status/transcription_ingestion_callback.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
class TranscriptionIngestionStatus(StatusCallback):
1313
"""
14-
Callback class for updating the status of a Lecture Transcription ingestion Pipeline run.
14+
Callback class for updating the status of a Transcription ingestion Pipeline run.
1515
"""
1616

1717
def __init__(

0 commit comments

Comments
 (0)