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

Deployment ordering #53

Closed
ThomasThelen opened this issue Nov 16, 2021 · 2 comments
Closed

Deployment ordering #53

ThomasThelen opened this issue Nov 16, 2021 · 2 comments
Assignees
Milestone

Comments

@ThomasThelen
Copy link
Member

This is an issue for cleaning up the dependency ordering in the deployment. Right now we're using the makefile that interacts with kubectl to wait for pods to be in the ready state. This works at the moment, but doesn't apply to the docker stack deployment and adds a layer of complexity to the deployment. It also makes things tricky with Helm charts (see #52).

The general idea is to bring the 'waiting' logic into the codebase and remove it from the deployment layer.

Scheduler

The scheduler is deployed in two steps: the first step is initialization of the scheduler (happens in the slinky cli), the second is starting rqschedule (happens on the command line). These steps can be seen in the deployment file.

Both of the steps require an active instance of redis and should be able to be started independently of each other without issue. Since rqscheduler is effectively moving jobs to different queues, it should be fine if the scheduler from the first step hasn't submitted the update_job job since it'll pick it up the next time it checks.

Solution

Making the scheduler portion of startup wait on redis can be achieved by adding a method that checks for redis with a timeout and threshold. This same code can be used with the workers (see below).

Unfortunately, rqschedule doesn't have a retry flag, but we can use the same logic above. I'd like to bring the call to rqschedule inside the Slinky cli. Either in def schedule or as a separate command. This would enable us to use the blocking code from above and would allow us to manage the dependency in the code.

Workers

The workers need to be able to perform database transactions (needs Virtuoso to be online). They also depend on redis.

Solution

Redis is easily tackled by using the blocking call from the scheduler solution.

A similar approach can be taken with Virtuoso, along the same lines as the readinessProbe

@amoeba
Copy link
Contributor

amoeba commented Nov 16, 2021

Thanks for writing this up, @ThomasThelen. Adding a CLI command for the rqscheduler and a retry mechanism sounds great.

Just as a note,

Since rqscheduler is effectively moving jobs to different queues

rqscheduler just submits any scheduled jobs to the queue they're to be scheduled on. Currently that's just enqueueing the Update job every n minutes in a cron-like fashion. No jobs are moved between queues. A worker listening to the Update queue does process the next Update job and the worker itself enqueues the jobs that actually process datasets to the Dataset queue, where a worker listening to the Dataset queue can pluck them from.

@amoeba
Copy link
Contributor

amoeba commented Feb 24, 2022

This was done by @ThomasThelen and merged to develop in #54.

@amoeba amoeba closed this as completed Feb 24, 2022
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

No branches or pull requests

2 participants