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

Sqlite setup #65

Merged
merged 9 commits into from
Sep 15, 2023
Merged

Sqlite setup #65

merged 9 commits into from
Sep 15, 2023

Conversation

dsantosferreira
Copy link
Contributor

@dsantosferreira dsantosferreira commented Jul 3, 2023

Closes #52

What was done

This PR creates a SQLite table to hold the statistics for which majors use TTS the most according to #45. A dump of that table is created at midnight and noon in UTC using Celery and Celery-beat.

What can be improved

The Celery setup that we currently have is the simplest it can be. That said, there is a better setup for django that I have tried to implement but unfortunately I couldn't get it to work. This django setup, although not completely necessary for what we have now, would make the code more organized if we use Celery for more features. I have created an issue #64 to try to use the django configuration for celery.

Testing

To test this PR you can change the local time on your PC to 12:59 (11:59 in UTC) and 00:59 (23:59 in UTC) to make sure that a dump is created exactly at midnight and noon. You can also temporarily remove the arguments in the crontab function in tasks.py so that the dump is created every minute. A file named statistics.sql should be created in tts-be/django/statistics.sql

@dsantosferreira dsantosferreira marked this pull request as draft August 7, 2023 12:53
@dsantosferreira dsantosferreira marked this pull request as ready for review August 7, 2023 12:53
@dsantosferreira
Copy link
Contributor Author

dsantosferreira commented Aug 7, 2023

Now that the statistics are stored in the mysql table, the statistics class doesn't seem necessary. Is it ok to remove it @SergioEstevao11 @ZeAntonioM?

The issue seems to be complete and ready to be reviewed

Copy link
Contributor

@SergioEstevao11 SergioEstevao11 left a comment

Choose a reason for hiding this comment

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

LGTM, gj! However, it's missing the initialization of the statistics with the cached values.
Created issue #68 for that

@SergioEstevao11 SergioEstevao11 linked an issue Sep 15, 2023 that may be closed by this pull request
@SergioEstevao11 SergioEstevao11 merged commit b349dd6 into develop Sep 15, 2023
@tomaspalma tomaspalma deleted the sqlite-setup branch September 20, 2024 09:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Setup SQLite for Analysis tool Analysis Tool - Scheduled Caching
3 participants