Always run snap on specific cpu (taskset)

Hi together,

I have created a Python project and put into a snap. But now I want that my snap is always executed on CPU 4. When I run my snap manually from the terminal via:

taskset -c 4 <snap_name>

The snap gets executed on the specified CPU 4. I validate this via the following command:

ps -eo pid,user,%cpu,psr --sort psr (psr -> processor that process is currently assigned to)

Now I want to automate this procedure and added this pre-command in the snapcraft.yaml under my app and added the plug process-control.

    command: taskset -c 4 bin/
        - process-control

Unfortunately, I keep getting this error:

Failed to generate snap metadata: The specified command 'taskset -c 4 bin/' defined in the app 'my-python-project' does not exist.

There is also a forum entry that taskset is supported via the process-control plugin, but obviously i don’t know how to use it: Process-control should also support taskset

Does anyone know how i implement my intentions and if it is possible ?

Thanks in advance!

You’re missing the taskset command inside your snap. You need to add the relevant stage-packages: entry to add the dependency into your snap.

thanks for the quick reply

i found this package and included it as a stage package

> - util-linux

but the same error results

i assumed that taskset is understood directly by the system as a command belonging to ubuntu