Commit f234447f by Belákovics Ádám

modified scheduler

parent 0ea5e0fd
Pipeline #673 passed with stage
in 0 seconds
......@@ -576,7 +576,7 @@ SESSION_COOKIE_NAME = "csessid%x" % (((getnode() // 139) ^
MAX_NODE_RAM = get_env_variable("MAX_NODE_RAM", 1024)
MAX_NODE_CPU_CORE = get_env_variable("MAX_NODE_CPU_CORE", 10)
SCHEDULER_METHOD = get_env_variable("SCHEDULER_METHOD", 'random')
SCHEDULER_METHOD = get_env_variable("SCHEDULER_METHOD", 'advanced')
# Url to download the client: (e.g. http://circlecloud.org/client/download/)
CLIENT_DOWNLOAD_URL = get_env_variable('CLIENT_DOWNLOAD_URL', 'http://circlecloud.org/client/download/')
......
......@@ -110,6 +110,7 @@ def select_node(instance, nodes):
logger.info('select_node: %s for %s', unicode(result), unicode(instance))
result.time_stamp = timezone.now()
result.save()
return result
......@@ -118,10 +119,11 @@ def sorting_key(node):
"""Determines how valuable a node is for scheduling.
"""
key = 0
corr = last_scheduled_correction_factor(node)
if free_cpu_time(node) < free_ram(node):
key = free_cpu_time(node)
key = free_cpu_time(node) * corr
else:
key = free_ram(node)
key = free_ram(node) * corr
return key
def last_scheduled_correction_factor(node):
......@@ -134,11 +136,13 @@ def last_scheduled_correction_factor(node):
factor = 0
max_time_diff = settings.SCHEDULER_TIME_SENSITIVITY_IN_SECONDS
current_time = timezone.now()
factor = (current_time - node.time_stamp)/max_time_diff
time_difference_in_seconds = (current_time - node.time_stamp).total_seconds()
factor = time_difference_in_seconds/float(max_time_diff)
if factor > 1:
factor = 1
elif factor < 0:
factor = 0
factor = 1
logger.info('Scheduler set factor to %s', unicode(factor))
return factor
def has_traits(traits, node):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment