Skip to content

Commit

Permalink
Update main.py
Browse files Browse the repository at this point in the history
  • Loading branch information
jizongFox authored May 30, 2023
1 parent f7ecacf commit 62f0a06
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions gpu_queue/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def get_args():
class JobSubmitter:

def __init__(self, job_array: Job_Array_Type, available_gpus: List[str] = ["0"], save_dir="log",
verbose=False) -> None:
verbose=False, wait_second:int=3) -> None:
super().__init__()
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
self.job_array = job_array
Expand All @@ -79,6 +79,7 @@ def __init__(self, job_array: Job_Array_Type, available_gpus: List[str] = ["0"],
self.gpu_queue.put(gpu)
print("%d jobs has been loaded" % len(self.job_array))
self.result_dict = {}
self.wait_second = wait_second

def submit_jobs(self):
while True:
Expand All @@ -87,7 +88,7 @@ def submit_jobs(self):
job = self.job_queue.get(timeout=1) # if it is going te be empty, end the program
gpu = self.gpu_queue.get(timeout=None, block=True) # this will wait forever
self._process_daemeon(job, gpu)
time.sleep(2)
time.sleep(self.wait_second)

except TimeoutError:
pass
Expand Down

0 comments on commit 62f0a06

Please sign in to comment.