[systemd-devel] 'tasks' as first-order objects?
notting at redhat.com
Thu Aug 12 12:56:33 PDT 2010
Lennart Poettering (lennart at poettering.net) said:
> > upstart jobs have two main types - 'services' and 'tasks'. systemd, while it
> > has many other types, doesn't have a 'task' analogue. So, for anything that
> > has the semantics of a task (at this time/dependency, do this thing and
> > exit), ends up being encoded as a service of type 'finish', often
> > with 'ValidNoProcess=yes'.
> Well, "Type=finish" is supposed to be exactly what Upstart calls
> "tasks". I must admit that the word "finish" for this sucks, so we are
> open to change this to make it more discoverable. However, I am not sure
> "task" is a good choice of names here either, since the low-level stuff
> we work with here already uses "tasks" for something else (i.e. as a
> generalization of processes and threads in the kernel). I wouldn't wan't
> to add confusion here.
Will those that are interacting with the unit files be the same set that
will interact with the 'task' low-level infrastructure?
If not, it might be OK to use the same verbiage.
> So, maybe "Type=transient" is nicer? Sounds a bit scientific but this
> word is not unheard in the Free software world at least (i.e. X uses
> that iirc) and describes pretty accurately what these kind of processes
> are used for, i.e. transient, temporary, short-running processes? Other
(None of these are necessarily good.)
> Two Examples: the audit policy loading is something for Type=finish,
> since the process "audictl" which does this starts and ends during boot
> and does not stay around during system runtime. You probably want to run
> it before you run auditd and as a dependency of it, but it probably
> makes sense to run it again if auditd terminates and you restart it
> later on. So this would be something to set to "Type=finish" and
> "ValidNoProcess=no". And it would *not* show up as "active" in systemctl
> during normal system runtime, because when the processes exited the
> service in systemd went away too.
I'd think you'd just run that as ExecStartPre in your auditd service.
Perhaps that's not the best example?
> So, I guess what I want to say is that processes have different
> semantics, and there is not clear dichotomy available. And because of
> that I'd wrap all this in one unit, and then differentiate them via
> Type= into the different styles.
> Does that make sense to you?
I think it might still make sense to separate them. You'd have other
benefits by distinguishing them:
- Separate defaults that make sense (Restart=on-success for services,
Restart=once (or not even a valid option) for tasks)
- Separated reporting, if you wanted (the random example above could
be considered as 'finished' instead of 'active/exited'.) This
may not fit fully into how systemd is organized.
> (Oh, and if you have a better suggestion for a name of ValidNoProcess= I
> am all ears too!)
Well, the neat thing about splitting off task and service like this
is that that key goes away.
More information about the systemd-devel