Skip to content
Snippets Groups Projects
Commit 7b4a9c09 authored by Mads M. Pedersen's avatar Mads M. Pedersen
Browse files

cluster_resource ok2submit returns number ok2submit

parent ea84bf7e
No related branches found
No related tags found
No related merge requests found
...@@ -12,7 +12,6 @@ import threading ...@@ -12,7 +12,6 @@ import threading
from wetb.utils.cluster_tools import pbswrap from wetb.utils.cluster_tools import pbswrap
def unix_path(path, cwd=None, fail_on_missing=False): def unix_path(path, cwd=None, fail_on_missing=False):
"""Convert case insensitive filename into unix case sensitive filename """Convert case insensitive filename into unix case sensitive filename
...@@ -73,17 +72,20 @@ class Resource(object): ...@@ -73,17 +72,20 @@ class Resource(object):
def ok2submit(self): def ok2submit(self):
"""Always ok to have min_cpu cpus and ok to have more if there are min_free free cpus""" """Always ok to have min_cpu cpus and ok to have more if there are min_free free cpus"""
try: try:
print ("ok2submit") #print ("ok2submit")
total, free, user = self.check_resources() total, free, user = self.check_resources()
print ("ok2submit", total, free, user) user = max(user, self.acquired)
user_max = max((self.min_cpu-user), self.cpu_free - self.min_free)
#print ("ok2submit", total, free, user, user_max)
return user_max
except: except:
return False return False
if user < self.min_cpu: # if user < self.min_cpu:
return True # return True
elif free > self.min_free: # elif free > self.min_free:
return True # return True
else: # else:
return False # return False
def acquire(self): def acquire(self):
with self.resource_lock: with self.resource_lock:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment