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

Adding/removing tasks for started scheduler #13

Open
gfrivolt opened this issue Dec 21, 2015 · 3 comments
Open

Adding/removing tasks for started scheduler #13

gfrivolt opened this issue Dec 21, 2015 · 3 comments

Comments

@gfrivolt
Copy link

Is there a possibility to add a task with a schedule for a started scheduler? I have two cases where this would be great to have:

  • the scheduler starts than other components can add their schedules, they would share the same one scheduler, otherwise probably I'd need to start up new scheduler for every case
  • there are some delayed jobs which should be executed after several minutes or hours. These are executed only once. These are things like failed job retries. After the task is executed, it can be removed from the list of tasks

Thank you for answer.

@zcaudate
Copy link
Member

funny that you asked that =)

it was supported previously but I nerfed it because I wanted it to be more immutable. I’m pretty sure it’s possible to add it back again.

the function should still be there:
https://github.com/zcaudate/cronj/blob/master/src/cronj/core.clj#L48-L52 https://github.com/zcaudate/cronj/blob/master/src/cronj/core.clj#L48-L52

Chris

On 21 Dec 2015, at 3:07 PM, György Frivolt notifications@github.com wrote:

Is there a possibility to add a task with a schedule for a started scheduler? I have two cases where this would be great to have:

the scheduler starts than other components can add their schedules, they would share the same one scheduler, otherwise probably I'd need to start up new scheduler for every case
there are some delayed jobs which should be executed after several minutes or hours. These are executed only once. These are things like failed job retries. After the task is executed, it can be removed from the list of tasks
Thank you for answer.


Reply to this email directly or view it on GitHub #13.

@gfrivolt
Copy link
Author

Great. I understand that it's good to have, where possible, things immutable.. but cronj scheduler is anyhow a changing structure. I see there are also other task list mutating functions like empty-tasks or unschedule-task so there are tools for task editing.

There is a {:pre [(tk/task? task)]} precondition, so the tasks must be running, otherwise they can not be added. But I see how simple it is to add a task to a scheduler. Is there any reason to keep that precondition?

Regarding immutability, maybe where now a "mutation" happened, a new scheduler would be returned referring to the previous scheduler.

@zcaudate
Copy link
Member

Yep! I totally get where you are coming from. It's actually pretty easy I add a task and no, it does not have to be running :)

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