Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Huge refactor of code #201

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Huge refactor of code #201

wants to merge 6 commits into from

Conversation

greenw0lf
Copy link
Collaborator

Similar refactor that was done to audio-extraction (see: beeldengeluid/audio-extraction-worker#28 and beeldengeluid/audio-extraction-worker#28 (comment)), mainly impacting exception raising and logging (no transcripts/provenance outputted as INFO, but as DEBUG now). Additionally, running the worker as a job was removed because it is tested and deployed as a service first and foremost.

Closes #124

@greenw0lf greenw0lf added the enhancement New feature or request label Jan 15, 2025
@greenw0lf greenw0lf requested a review from Veldhoen January 15, 2025 12:50
@greenw0lf greenw0lf self-assigned this Jan 15, 2025
latest version includes the logging I added of the audio duration and how much audio the VAD removes
Copy link
Member

@Veldhoen Veldhoen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job, lots of improvements that makes the code more readable, clear, maintainable!
Of course, since it's a big PR, I still have quite some suggestions for improvement. Let me know if anything is unclear, or if you want to discuss anything!

api.py Outdated Show resolved Hide resolved
api.py Outdated Show resolved Hide resolved
task.status = Status.DONE
task.response = outputs
logger.info(f"Successfully transcribed task {task.id}")
except Exception as e:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to catch specific errors you know may occur, although it does make sense to catch a general 'Exception' at the end.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. My reasoning was that, this way, I catch any type of exception that could be thrown and I don't think the type matters too much since the exception itself will also be logged.

api.py Show resolved Hide resolved
api.py Outdated Show resolved Hide resolved
transcode.py Show resolved Hide resolved
transcode.py Outdated Show resolved Hide resolved
transcode.py Outdated Show resolved Hide resolved
whisper.py Outdated Show resolved Hide resolved
whisper.py Outdated Show resolved Hide resolved
@Veldhoen
Copy link
Member

NB I merely looked at the code. Do you also have a test plan in mind?

@greenw0lf
Copy link
Collaborator Author

I have no test plan at the moment for this PR. Only tested locally using Docker and it was working as expected. If you also mean to create a suite of unit tests, I unfortunately won't have time for that this week and I won't be able to work on this further starting next week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Proper error handling and reporting to the API for the worker
2 participants