Skip to content
Snippets Groups Projects
Commit d39da16f authored by mads's avatar mads
Browse files

stuff

parent 470f6467
No related branches found
No related tags found
No related merge requests found
......@@ -169,7 +169,7 @@ class HTCFile(HTCContents, HTCDefaults):
return [f for f in files if f]
def turbulence_files(self):
if self.wind.turb_format[0] == 0:
if 'wind' not in self.contents.keys() or self.wind.turb_format[0] == 0:
return []
elif self.wind.turb_format[0] == 1:
files = [self.get('wind.mann.filename_%s' % comp, [None])[0] for comp in ['u', 'v', 'w']]
......
......@@ -169,6 +169,16 @@ class LogFile(LogInterpreter):
if txt != "":
LogInterpreter.update_status(self, txt)
class LogInfo(LogFile):
def __init__(self, status, pct, remaining_time, lastline):
self.status = status
self.pct = int(pct)
try:
self.remaining_time = float(remaining_time)
except:
self.remaining_time = None
self.lastline = lastline
self.errors = []
def update_status(self):
pass
\ No newline at end of file
This diff is collapsed.
......@@ -11,33 +11,6 @@ import psutil
class Resource(object):
pass
class LocalResource(Resource):
def __init__(self, process_name):
self.process_name = process_name
self.no_users = 1
self.host = 'Localhost'
def check_resources(self):
def name(i):
try:
return psutil.Process(i).name
except psutil._error.AccessDenied:
pass
no_cpu = multiprocessing.cpu_count()
cpu_free = (1 - psutil.cpu_percent(.5) / 100) * no_cpu
no_current_process = len([i for i in psutil.get_pid_list() if name(i) == self.process_name])
return no_cpu, cpu_free, no_current_process
def ok2submit(self):
total, free, user = self.check_resources()
minimum_cpus = total * 1 / self.no_users
if user < minimum_cpus and free > 2:
return True
else:
return False
......@@ -78,5 +51,33 @@ class PBSClusterResource(Resource, SSHClient):
return True
else:
return False
pass
class LocalResource(Resource):
def __init__(self, process_name):
self.process_name = process_name
self.no_users = 1
self.host = 'Localhost'
def check_resources(self):
def name(i):
try:
return psutil.Process(i).name
except psutil._error.AccessDenied:
pass
no_cpu = multiprocessing.cpu_count()
cpu_free = (1 - psutil.cpu_percent(.5) / 100) * no_cpu
no_current_process = len([i for i in psutil.get_pid_list() if name(i) == self.process_name])
return no_cpu, cpu_free, no_current_process
def ok2submit(self):
total, free, user = self.check_resources()
minimum_cpus = total * 1 / self.no_users
if user < minimum_cpus and free > 2:
return True
else:
return False
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