"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "pylint/lint/run.py" between
pylint-2.14.1.tar.gz and pylint-2.14.2.tar.gz

About: pylint analyzes Python source code looking for bugs and signs of poor quality.

run.py  (pylint-2.14.1):run.py  (pylint-2.14.2)
skipping to change at line 60 skipping to change at line 60
): ):
with open("/sys/fs/cgroup/cpu/cpu.cfs_period_us", encoding="utf-8") as f ile: with open("/sys/fs/cgroup/cpu/cpu.cfs_period_us", encoding="utf-8") as f ile:
cpu_period = int(file.read().rstrip()) cpu_period = int(file.read().rstrip())
# Divide quota by period and you should get num of allotted CPU to the c ontainer, rounded down if fractional. # Divide quota by period and you should get num of allotted CPU to the c ontainer, rounded down if fractional.
avail_cpu = int(cpu_quota / cpu_period) avail_cpu = int(cpu_quota / cpu_period)
elif Path("/sys/fs/cgroup/cpu/cpu.shares").is_file(): elif Path("/sys/fs/cgroup/cpu/cpu.shares").is_file():
with open("/sys/fs/cgroup/cpu/cpu.shares", encoding="utf-8") as file: with open("/sys/fs/cgroup/cpu/cpu.shares", encoding="utf-8") as file:
cpu_shares = int(file.read().rstrip()) cpu_shares = int(file.read().rstrip())
# For AWS, gives correct value * 1024. # For AWS, gives correct value * 1024.
avail_cpu = int(cpu_shares / 1024) avail_cpu = int(cpu_shares / 1024)
# In K8s Pods also a fraction of a single core could be available
# As multiprocessing is not able to run only a "fraction" of process
# assume we have 1 CPU available
if avail_cpu == 0:
avail_cpu = 1
return avail_cpu return avail_cpu
def _cpu_count() -> int: def _cpu_count() -> int:
"""Use sched_affinity if available for virtualized or containerized """Use sched_affinity if available for virtualized or containerized
environments. environments.
""" """
cpu_share = _query_cpu() cpu_share = _query_cpu()
cpu_count = None cpu_count = None
sched_getaffinity = getattr(os, "sched_getaffinity", None) sched_getaffinity = getattr(os, "sched_getaffinity", None)
# pylint: disable=not-callable,using-constant-test,useless-suppression # pylint: disable=not-callable,using-constant-test,useless-suppression
 End of changes. 1 change blocks. 
0 lines changed or deleted 7 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)