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

Systemd timer format for periodic jobs #18079

Open
aneustroev opened this issue Jul 27, 2023 · 5 comments
Open

Systemd timer format for periodic jobs #18079

aneustroev opened this issue Jul 27, 2023 · 5 comments

Comments

@aneustroev
Copy link
Contributor

Hi there, I want to suggest implement PeriodicSpecSystemd

Proposal

I want to add another one PeriodicSpecType.
https://www.freedesktop.org/software/systemd/man/systemd.time.html
It is more flexible and usefull for many system administration who knows how to managing systemd.

I forked you cronexpr library, and add systemd timers functionality. (also rewrite some tests and add my)
https://github.com/WinnerSoftLab/cronexpr

I can implement it in Nomad, but after my PR #17858 will be merged , because it will have a lot conflicts if I violate the order merges.

Use-cases

Nomad get more flexible and famous format for describe periodic job times.

@tgross tgross self-assigned this Jul 28, 2023
@tgross
Copy link
Member

tgross commented Jul 28, 2023

Hi @aneustroev! This proposal raises a couple of questions for me:

  • Is the systemd.time syntax equivalently expressive as cron syntax? That is, are there intervals that systemd.time that cron cannot or vice-versa?
  • We typically talk about two "personas" of Nomad user: the cluster administrator and the job author. Typically the cluster administrator is someone with more of a sysadmin background, where they might be familiar with cron syntax or systemd.time syntax from their use with cron (or modern replacements) and systemd timers. Whereas the job author might also be the cluster administrator but for many organizations is an application developer. The job author might not be familiar with cron syntax, but I'm not sure that the same author would be more familiar with systemd.time syntax either?

In any case, even if we were to do this, the systemd.time parsing would need to live alongside the cron syntax for backwards compatibility purposes. And we definitely wouldn't want that parsing to be in the cronexpr library; that's specifically for cron syntax so adding another Linux-specific syntax there doesn't make a lot of sense from a library design standpoint.

@aneustroev
Copy link
Contributor Author

Hi. I don't ask about change format, just about option. 😄 Now you have job.SpecType in Nomad code, but it use only for tests.

Is the systemd.time syntax equivalently expressive as cron syntax?
Yes, a little bit spec

  • seconds support
  • year's support
    And about second question, systemd.time format more human-readable, because it follow nnative time format.
5 4 * * *
# vs
*-*-* 04:05:00 
# or just 
04:05

and with dates

5 4 */2 4-5 *
# vs
*-4..5-01/2 04:05:00 
# or shorter form 
*-4..5-01/2 04:05

Our programmers have no problems and prefer it.

I agree with you about cronexpr design, but parsing systemd.time on 99% similar that cron 😄 that because I extend library for my PoC. It doesn't look like problem, I can create another one separate repository.

@tgross tgross removed their assignment Jul 31, 2023
@tgross
Copy link
Member

tgross commented Jul 31, 2023

Thanks for the clarification @aneustroev. I'm not sure we're definitely going to accept this but I'll move it into roadmapping for further discussion.

@aneustroev
Copy link
Contributor Author

I made PR #19682, and we use it in production for a month without any problems.
Also this allowed us easy migrate from systemd timers to nomad.
@tgross Can you pay attention for my PR please?

@tgross
Copy link
Member

tgross commented Apr 4, 2024

Hi @aneustroev, I'll try to get that reviewed in the next week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Needs Roadmapping
Development

No branches or pull requests

2 participants