-
-
Notifications
You must be signed in to change notification settings - Fork 196
Add cron worker for dispatched jobs through the database #567
base: master
Are you sure you want to change the base?
Conversation
|
Thank you @vzool !!! I wish I knew enough to review this myself! ;) @wellingguzman will check it out Monday and we'll hopefully get this in the next release! Thanks again, we really appreciate the help! |
wellingguzman
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @vzool for this contribution. We are reviewing this PR.
|
😊
…On Mon, Nov 5, 2018 at 6:57 PM Welling Guzmán ***@***.***> wrote:
***@***.**** commented on this pull request.
Thanks @vzool <https://github.com/vzool> for this contribution. We are
reviewing this PR.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#567 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AEuSoD6yWp68W5RnIM0FcTZWk0zQxjyRks5usF_egaJpZM4YM4OZ>
.
|
|
@wellingguzman Finally, I guess I did all the tests now 😆 |
|
@wellingguzman Still reviewing this PR 🙃 |
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
|
@wellingguzman — can you post some thoughts on this here? |
|
Is it possible for this to be bundled as an extension, also can the installer specify the name of the collection that would hold the queue? |
|
Hey @vzool — Welling left the organization, but we'll have @BJGajjar take a look. @philleepflorence — I would say that this should be in in the Core (not an extension)... as long as we find a modular way to allow for different server schedulers (Apache, nginx, etc). I think we could have a single system collection for managing the job queue since that is not server dependent. Something like
Then we just need a modular way to run the code every minute. My thinking is that we have a cron job (or whatever your server supports) that runs every minute, checks the I'm not sure how this PR works... but that's my (super basic) concept. :) |
|
@benhaynes - agreed, makes sense. |
|
Interesting, I like the idea of allowing the task to hit an endpoint. My only concern is that there's no way to setup custom endpoints through the App, which means you need server access. The benefit of the "file" approach is that we could allow for uploading and setting up everything through the app. So perhaps we look into supporting both? |
|
@rijkvanzanten and @BJGajjar — could you guys give me your thoughts on this PR? I like the idea of having a way to schedule tasks, but I don't know enough to audit this code/approach. |
|
I like the idea of being able to do stuff at a given time, but it's unfortunate that you have to go "around" PHP (eg do stuff on the CLI) to set it up. It makes sense, as PHP doesn't have a constant running process, but that does make it a bit hard to use. |
|
One way to do it is to have a master Cron Process per installation that runs every minute and then manage project tasks via directus, having PHP call the scripts or URLs of the individual tasks. On cronjobs collection save in the DB, update a file in the filesystem that the cronjob looks at - minimizes DB overhead. This is a set up currently in use on some Directus installations. So there is no need for system admins after launch. |
|
I like the idea of having this be "decoupled from PHP" as much as possible. I'd love to store the tasks in the database so that if we move to node.js API in the future the tasks themselves don't need to change. And having a CRON job that runs every minute (like @philleepflorence mentioned) and then check/trigger the tasks as needed sounds perfect. I like it! |
Hi,
This is a cron job worker using the database as a transfer layer between the dispatcher and the consumer which is a cron job in our situation. and it does resolve the feature request #560
> /home/app/directus/bin/cron_workerAny Task should implements TaskInterface like this:
Testing Progress:
Notes:
Exit-On-First-Errormode by default which make sense for cron jobs environment if you called every minute, but you can change that behaviour by the following line:> /home/app/directus/bin/cron_worker ignore-errorsIgnore-Errorsmode and there is an error the worker will hit that error every single second until you fix it. This is so annoying if you have an automatic bug reporter by email or SMS.Any idea is welcome here, Thanks 😘