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

Cron / Updated cli #234

Merged
merged 5 commits into from
Jan 22, 2024
Merged

Cron / Updated cli #234

merged 5 commits into from
Jan 22, 2024

Conversation

MelissaAutumn
Copy link
Member

Fixes #230

I spent a while researching options for a cron scheduler, and they're all kind of ehh. I think it's okay to simply create some purpose built commands and add them manually to our cron file in scripts. Right now that file is empty, and the cron only runs on dev.

I've added typer CLI, which seems to be made by the same person as fastapi. (https://typer.tiangolo.com/typer-cli/) This replaces my if statement, and should allow us to easily create cli commands as needed. There's still no way to use the cli from aws though, so I expect only the update-db and cron commands will ever be made.

I've also added a helper contextmanager function to create and remove a lock file if one doesn't already exist. If you create a cron command, make sure to use it!

@@ -12,6 +12,11 @@ COPY requirements.txt .
COPY pyproject.toml .
COPY alembic.ini.example alembic.ini
COPY scripts/entry.sh scripts/entry.sh
COPY scripts/cron /etc/cron.d/appointment-cron
Copy link
Collaborator

Choose a reason for hiding this comment

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

This cron file is currently empty, right? Should we add an example entry here for convenience? Or add some documentation how to use it? Or is this handled by Typer automatically?

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh yea sorry, the cron is empty. Once we want to add stuff we'll just stuff it in that file and it should work.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice, fine by me 👍🏻

@devmount devmount merged commit edee10e into main Jan 22, 2024
1 check passed
@devmount devmount deleted the features/230-cron branch January 22, 2024 15:24
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.

Cron
2 participants