You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by no...@apache.org on 2020/12/29 12:30:21 UTC

[buildstream] 13/21: WIP: win32: platform: os.uname and resource

This is an automated email from the ASF dual-hosted git repository.

not-in-ldap pushed a commit to branch aevri/win32
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit abb0dac8a8bf4281fee48e91924998b1076b9fbc
Author: Angelos Evripiotis <je...@bloomberg.net>
AuthorDate: Tue Apr 2 13:16:19 2019 +0100

    WIP: win32: platform: os.uname and resource
---
 src/buildstream/_platform/platform.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/buildstream/_platform/platform.py b/src/buildstream/_platform/platform.py
index 4c147b5..0d513fb 100644
--- a/src/buildstream/_platform/platform.py
+++ b/src/buildstream/_platform/platform.py
@@ -20,7 +20,9 @@
 import os
 import platform
 import sys
-import resource
+#import resource
+
+import psutil
 
 from .._exceptions import PlatformError, ImplError
 
@@ -72,7 +74,7 @@ class Platform():
         return cls._instance
 
     def get_cpu_count(self, cap=None):
-        cpu_count = len(os.sched_getaffinity(0))
+        cpu_count = len(psutil.Process().cpu_affinity())
         if cap is None:
             return cpu_count
         else:
@@ -159,6 +161,8 @@ class Platform():
         # Need to set resources for _frontend/app.py as this is dependent on the platform
         # SafeHardlinks FUSE needs to hold file descriptors for all processes in the sandbox.
         # Avoid hitting the limit too quickly.
+        return
+        import resource
         limits = resource.getrlimit(resource.RLIMIT_NOFILE)
         if limits[0] != limits[1]:
             if soft_limit is None: