diff --git a/backend/src/backend/experiments/calc_surf_isec_inmem.py b/backend/src/backend/experiments/calc_surf_isec_inmem.py index 4591ab5c1..1fbb5c510 100644 --- a/backend/src/backend/experiments/calc_surf_isec_inmem.py +++ b/backend/src/backend/experiments/calc_surf_isec_inmem.py @@ -202,17 +202,20 @@ async def calc_surf_isec_inmem( def query_cpu(): + cpu_quota = -1 + avail_cpu = -1 + if os.path.isfile('/sys/fs/cgroup/cpu/cpu.cfs_quota_us'): cpu_quota = int(open('/sys/fs/cgroup/cpu/cpu.cfs_quota_us').read().rstrip()) - #print(cpu_quota) # Not useful for AWS Batch based jobs as result is -1, but works on local linux systems + print(cpu_quota) # Not useful for AWS Batch based jobs as result is -1, but works on local linux systems if cpu_quota != -1 and os.path.isfile('/sys/fs/cgroup/cpu/cpu.cfs_period_us'): cpu_period = int(open('/sys/fs/cgroup/cpu/cpu.cfs_period_us').read().rstrip()) - #print(cpu_period) + print(cpu_period) avail_cpu = int(cpu_quota / cpu_period) # Divide quota by period and you should get num of allotted CPU to the container, rounded down if fractional. elif os.path.isfile('/sys/fs/cgroup/cpu/cpu.shares'): cpu_shares = int(open('/sys/fs/cgroup/cpu/cpu.shares').read().rstrip()) - #print(cpu_shares) # For AWS, gives correct value * 1024. + print(cpu_shares) # For AWS, gives correct value * 1024. avail_cpu = int(cpu_shares / 1024) return avail_cpu \ No newline at end of file