did stuff

This commit is contained in:
2021-12-12 02:07:26 +01:00
parent 0765d98c1f
commit 2e8a4d25b4
3 changed files with 50 additions and 6 deletions

View File

@@ -1,5 +1,26 @@
from typing import Dict
import logging
from redis import Redis
import requests
from config import Config
from urllib.parse import urljoin
def run():
logging.info("Csirip")
def run(redis_client: Redis, site_url_map: Dict[str, str]):
# Get weather report
# get {http://example.com/report/}{site} The first part supplied
logging.debug("Getting performance reports...")
r = requests.get(urljoin(Config.COLLECTOR_URL, "site"), timeout=10)
r.raise_for_status()
# TODO:
# - set the default scheduling site
# - Check if scheduling is required: any derivatives are above 0 for an extended period
# - if yes, then decide where to schedule
# - any sites with 0 derivative?
# - Check the k8s api before scheduling to see if the pod is running
# - check if there are any pod running where 0 units scheduled for extended time
# - delete that pod
# - write some log, so we can draw nice graphs
# Optional: check if a higher priority pod have free capacity, and move lower ones up