Python3 only using one core

This forum is for topics dealing with problems with software specifically in the ARMv7h repo.

Python3 only using one core

Postby jonandermb » Sat Jan 26, 2019 9:11 pm

I don't know if this goes here but I don't really know where else to ask.

See, I have a rapsberry pi 3B+ with docker, running home-assistant inside of a container.

Home assistant makes use of python3 to run. You can actually just run it inside a virtual python environment, without the need of docker.

The issue here is that when I start this docker or just home-assistant as standalone, I only see python using one of the cores at 100% full time, and having this happen outside of docker too has finally made me think there's some issue with python.

Does it make any sense what I'm saying? Can it be the way python is packed for our distro? can I tune python in any way?

Thanks!
jonandermb
 
Posts: 21
Joined: Fri Jan 10, 2014 7:44 pm

Re: Python3 only using one core

Postby lephonet » Fri Feb 01, 2019 3:30 pm

Probably it's not due to the Python backend but more of how the Python scripts were actually written.
I think scripts do run on a single thread, requiring only one core then.

Have you checked the scripts yourself if says something like $this->bbcode_second_pass_code('', 'import threading') or $this->bbcode_second_pass_code('', 'import _thread')?
lephonet
 
Posts: 3
Joined: Thu Jan 31, 2019 4:41 pm

Re: Python3 only using one core

Postby lephonet » Fri Feb 01, 2019 3:39 pm

I think you mean this with home-assistant https://github.com/home-assistant/home-assistant and it does use threads.

Maybe docker hasn't allocated that much resources by default.

You can maybe pass something like `--cpus=2` when launching the container

https://docs.docker.com/config/containe ... aints/#cpu
lephonet
 
Posts: 3
Joined: Thu Jan 31, 2019 4:41 pm

Re: Python3 only using one core

Postby jonandermb » Fri Feb 01, 2019 5:39 pm

Sorry: I recently found the reason for my issue and it-s not a python issue definitely.

Basically, there's a script in home assistant that deals with some wifi gadgets and it was getting in conflict with another home assistant setup that was trying to access those same devices. The interacting script was just going nuts about that and taking 100% cpu usage.
jonandermb
 
Posts: 21
Joined: Fri Jan 10, 2014 7:44 pm


Return to ARMv7h

Who is online

Users browsing this forum: No registered users and 19 guests