<div dir="ltr"><div dir="ltr"></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Mar 15, 2022 at 1:29 PM Lennart Poettering <<a href="mailto:lennart@poettering.net">lennart@poettering.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Mo, 14.03.22 23:12, Felip Moll (<a href="mailto:felip@schedmd.com" target="_blank">felip@schedmd.com</a>) wrote:<br>
<br>
> > But note that you can also run your main service as a service, and<br>
> > then allocate a *single* scope unit for *all* your payloads.<br>
><br>
> The main issue is the scope needs a pid attached to it. I thought that the<br>
> scope could live without any process inside, but that's not happening.<br>
> So every time a user step/job finishes, my main process must take care of<br>
> it, and launch the scope again on the next coming job.<br>
<br>
Leave a stub process around in it. i.e something similar to<br>
"/bin/sleep infinity".<br>
<br></blockquote><div><br></div><div>Ok.. this was my initial idea.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
> The forked process just does the dbus call, and when the scope is ready it<br>
> is moved to the corresponding cgroup (PIDFile=).<br>
<br>
Hmm? PIDFile= is a property of *services*, not *scopes*.<br>
<br></blockquote><div><br></div><div>Sorry I meant PIDs, not PIDFile of course.<br></div><div></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
And "scopes" cannot be moved to "cgroups". I cannot parse the above.<br>
<br></blockquote><div><br></div><div>The forked process X does the dbus call to start the scope with PIDs=$(pidof X), and when the scope is ready,</div><div>X is moved into the scope cgroup.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Did you read up on scopes and services?<br>
<br>
See <a href="https://systemd.io/CGROUP_DELEGATION/" rel="noreferrer" target="_blank">https://systemd.io/CGROUP_DELEGATION/</a>, it explains the concept of<br>
"scopes". Scopes *have* cgroups, but cannot be moved to "cgroups".<br>
<br></blockquote><div><br></div><div>Yes, it was a misunderstanding of my previous sentence.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
> Problem number one: if other processes are in the scope, the dbus call<br>
> won't work since I am using the same name all the time, e.g.<br>
> slurmstepd.scope.<br>
> So I first need to check if the scope exists and if so put the new<br>
> slurmstepd process inside. But we still have the race condition, if during<br>
> this phase all steps ends, systemd will do the cleanup.<br>
<br>
Leave a stub process around in it. </blockquote><div><br></div><div>Ok, then I don't see the real difference of starting up a new service.<br></div><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
> If instead I could just ask systemd to delegate a part of the tree for my<br>
> processes, then everything would be solved.<br>
<br>
I don't follow. You can enable delegation on the scope. I mean, that's<br>
the reason I suggested to use a scope.<br>
<br></blockquote><div><br></div><div>Meaning that it would be great to have a delegated cgroup subtree without the need of a service or scope.<br></div><div>Just an empty subtree.</div><div></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
> Do you have any other suggestions?<br>
<br>
Not really, except maybe: please read up on the documentation, it<br>
explains a lot of the concepts.<br>
<br></blockquote><div><br></div><div>I've done, I may not be expressing myself perfectly though. I apologize for that.<br></div><div> </div></div></div>