Skip to content

Commit

Permalink
Update README, fix node memory and cpu allocation
Browse files Browse the repository at this point in the history
  • Loading branch information
cerberus committed Mar 21, 2024
1 parent efdc01c commit 953dff8
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 4 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: Python application

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

permissions:
contents: read

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ SHELL := /bin/bash

.PHONY: install run run-detailed

INPUT?=data_sample/example.csv

install:
python3 -m venv .venv
. ./.venv/bin/activate
Expand All @@ -15,7 +17,7 @@ run:

run-detailed:
. ./.venv/bin/activate
python main.py -i data_sample/example.csv -d
python main.py -i ${INPUT} -d

run-debug:
. ./.venv/bin/activate
Expand Down
2 changes: 1 addition & 1 deletion lib/create_pod_list.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from math import floor


#TODO: Track odd pod counts or anti-affinity and use CEILING instead of FLOOR
class CreatPodList(object):
@staticmethod
def get_antiaffinity(anti_affinity: int) -> int:
Expand Down
4 changes: 2 additions & 2 deletions lib/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ def __init__(self, name: int, mem_total: int, cpu_total: int, allocation: int):
self.mem_total = mem_total - kublet_reserve_mem(mem_total)
self.cpu_total = cpu_total - kublet_reserve_cpu(cpu_total)
self.allocation = allocation
self.mem_available = mem_total * (allocation / 100)
self.cpu_available = cpu_total * (allocation / 100)
self.mem_available = self.mem_total * (allocation / 100)
self.cpu_available = self.cpu_total * (allocation / 100)
self.mem_used = 0
self.cpu_used = 0
self.pods = []
Expand Down

0 comments on commit 953dff8

Please sign in to comment.