Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions mig/server/bestfitscheduler.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# --- BEGIN_HEADER ---
#
# bestfitscheduler - best fit job scheduler
# Copyright (C) 2003-2023 The MiG Project lead by Brian Vinter
# Copyright (C) 2003-2026 The MiG Project by the Science HPC Center at UCPH
#
# This file is part of MiG.
#
Expand All @@ -20,7 +20,8 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
#
# -- END_HEADER ---
#
Expand All @@ -33,7 +34,7 @@
from mig.server.scheduler import Scheduler


class BestFitScheduler(Scheduler):

Check failure on line 37 in mig/server/bestfitscheduler.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

unused class 'BestFitScheduler' (60% confidence)

def __init__(self, logger, config):
Scheduler.__init__(self, logger, config)
Expand All @@ -59,7 +60,7 @@
try:
job_val = float(job[attr])
res_val = float(resource_conf[attr])
except:

Check warning on line 63 in mig/server/bestfitscheduler.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

do not use bare 'except'
self.logger.error(
'fitness: float conversion for %s failed!', attr)
continue
Expand Down Expand Up @@ -116,6 +117,7 @@

best_job = None
best_fitness = 0.0
best_i = 0

for i in range(0, qlen):
job = self.job_queue.get_job(i)
Expand All @@ -126,7 +128,7 @@
if key not in job or val != job[key]:
continue

# self.logger.debug("schedule treating job %d: %s", i, job['JOB_ID'])

Check warning on line 131 in mig/server/bestfitscheduler.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (81 > 80 characters)

if 'GO' == job['SCHEDULE_HINT']\
and resource_conf['RESOURCE_ID']\
Expand Down
5 changes: 3 additions & 2 deletions mig/server/scheduler.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# --- BEGIN_HEADER ---
#
# scheduler - base scheduler class used by all schedulers
# Copyright (C) 2003-2024 The MiG Project lead by Brian Vinter
# Copyright (C) 2003-2026 The MiG Project by the Science HPC Center at UCPH
#
# This file is part of MiG.
#
Expand All @@ -20,7 +20,8 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
#
# -- END_HEADER ---
#
Expand All @@ -32,7 +33,7 @@
from __future__ import division

from builtins import range
from builtins import object

Check failure on line 36 in mig/server/scheduler.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

unused import 'object' (90% confidence)
import calendar
import fnmatch
import re
Expand Down Expand Up @@ -106,7 +107,7 @@

peers = None

# High and Low watermarks for resource load - 0.25 means that 25% of resource

Check warning on line 110 in mig/server/scheduler.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (81 > 80 characters)
# jobrequests are given a job (average)

lo_load = 0.45
Expand Down Expand Up @@ -178,21 +179,21 @@
def _clone_job(self, job):
return self._clone_dict(job)

def attach_job_queue(self, job_queue):

Check failure on line 182 in mig/server/scheduler.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

unused method 'attach_job_queue' (60% confidence)

# Bind supplied job_queue to this scheduler

self.job_queue = job_queue
self.update_local_server()

def attach_done_queue(self, done_queue):

Check failure on line 189 in mig/server/scheduler.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

unused method 'attach_done_queue' (60% confidence)

# Bind supplied done_queue to this scheduler

self.done_queue = done_queue
self.update_local_server()

def set_cache(self, cache):

Check failure on line 196 in mig/server/scheduler.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

unused method 'set_cache' (60% confidence)

# Bind supplied cache to this scheduler and expire old entries

Expand All @@ -201,7 +202,7 @@
self.expire_entitites(entities)
self.update_local_server()

def get_cache(self):

Check failure on line 205 in mig/server/scheduler.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

unused method 'get_cache' (60% confidence)

# Extract cache from this scheduler

Expand All @@ -218,7 +219,7 @@
cost = self.server_migrate_cost(server_id)
return cost

def user_migrate_cost(self, user_conf):

Check failure on line 222 in mig/server/scheduler.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

unused method 'user_migrate_cost' (60% confidence)
server_id = user_conf['SERVER']
cost = self.server_migrate_cost(server_id)
return cost
Expand Down Expand Up @@ -251,7 +252,7 @@
direction = self.server_direction(server_id)
return direction

def user_direction(self, user_conf):

Check failure on line 255 in mig/server/scheduler.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

unused method 'user_direction' (60% confidence)
server_id = user_conf['SERVER']
direction = self.server_direction(server_id)
return direction
Expand All @@ -268,7 +269,7 @@
try:
cur_timestamp = float(cur_entity['LAST_SEEN'])
new_timestamp = float(new_entity['LAST_SEEN'])
except:

Check warning on line 272 in mig/server/scheduler.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

do not use bare 'except'
self.logger.warning('updated_data: failed to get timestamp! %s %s'
% (cur_entity, new_entity))
return False
Expand All @@ -286,7 +287,7 @@

try:
timestamp = float(entity['LAST_SEEN'])
except:

Check warning on line 290 in mig/server/scheduler.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

do not use bare 'except'
self.logger.warning('outdated_data: failed to get timestamp! %s'
% entity)
return True
Expand Down Expand Up @@ -330,7 +331,7 @@
cur_cost = self.server_migrate_cost(cur_server['SERVER_ID'])
new_cost = float(new_server['MIGRATE_COST'])
except Exception as exc:
self.logger.warning('relevant_update: get migrate cost failed! %s %s (%s)'

Check warning on line 334 in mig/server/scheduler.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (86 > 80 characters)
% (cur_server, new_server, exc))
return False

Expand Down Expand Up @@ -408,7 +409,7 @@
server = self.find_server(server_conf)
if server:

# self.logger.debug("update_servers: %s already in servers list" % server["SERVER_ID"])

Check warning on line 412 in mig/server/scheduler.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (99 > 80 characters)
# Truncate conf options to catch changes

for attr in inc_list:
Expand Down Expand Up @@ -514,8 +515,8 @@

user['QUEUE_HIST'] = []

# TODO: sched hist is difficult to maintain since jobs get scheduled concurrently

Check warning on line 518 in mig/server/scheduler.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (89 > 80 characters)
# at different servers (vector clocks or similar are needed to allow correct SCHED_HIST p2p information)

Check warning on line 519 in mig/server/scheduler.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (112 > 80 characters)

user['SCHED_HIST'] = []
user['DONE_HIST'] = []
Expand Down Expand Up @@ -566,7 +567,7 @@
if fill_in:

# Add a new local resource
# self.logger.debug("update_resources: adding %s to resource list" % res_id)

Check warning on line 570 in mig/server/scheduler.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (88 > 80 characters)

res['LOAD'] = 0.0
res['LAST_LOAD'] = 0.0
Expand Down
Loading