Skip to content

Commit

Permalink
Merge pull request #25 from kkingstoun/main
Browse files Browse the repository at this point in the history
Fix some linter errors
  • Loading branch information
kkingstoun authored Feb 16, 2024
2 parents 19e0ddc + 4e6357f commit bea8796
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
4 changes: 2 additions & 2 deletions manager/manager/components/queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def pause_jobs(self):
"""
Pause all jobs in the queue.
"""
while caches["schedule_jobs"] == True:
while caches["schedule_jobs"]:
time.sleep(10)

def schedule_jobs(self):
Expand All @@ -87,7 +87,7 @@ def schedule_jobs(self):
If there are no available GPUs, the jobs will remain in the queue until a GPU becomes available.
"""
for job in self.ordered_jobs:
if cache.get("schedule_jobs", default=False) == False:
if not cache.get("schedule_jobs", default=False):
available_gpu = self.waiting_gpus
if available_gpu:
print(f"Run job {job.id} on GPU {available_gpu.id}")
Expand Down
2 changes: 1 addition & 1 deletion manager/manager/components/run_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def run_job(self, job=None, gpu=None, request=None):
print(f"run_job: {e}")
logger.error(e)

def send_run_command(self, job, gpu):
def send_run_command(self, job, _gpu):
channel_layer = get_channel_layer()
async_to_sync(channel_layer.group_send)(
"nodes_group", # Assume a group name for nodes
Expand Down
11 changes: 5 additions & 6 deletions manager/manager/components/scheduler.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import threading
import time
import warnings

from schedule import Scheduler

Expand All @@ -14,18 +13,18 @@ def __init__(self, *args, **kwargs):
def start(self) -> None:
"""Protect from running start method multiple times"""
if not self.running:
super(RepeatTimer, self).start()
super().start()
self.running = True
else:
warnings.warn("Timer is already running, cannot be started again.")
print("Timer is already running, cannot be started again.")

def cancel(self) -> None:
"""Protect from running stop method multiple times"""
if self.running:
super(RepeatTimer, self).cancel()
super().cancel()
self.running = False
else:
warnings.warn("Timer is already canceled, cannot be canceled again.")
print("Timer is already canceled, cannot be canceled again.")

def run(self):
"""Replace run method of timer to run continuously"""
Expand All @@ -37,7 +36,7 @@ class ThreadedScheduler(Scheduler):
_instance = None
_lock = threading.Lock()

def __new__(cls, *args, **kwargs):
def __new__(cls, *_args, **_kwargs):
with cls._lock:
if cls._instance is None:
cls._instance = super().__new__(cls)
Expand Down

0 comments on commit bea8796

Please sign in to comment.