Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some linter errors #25

Merged
merged 1 commit into from
Feb 16, 2024
Merged
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
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