work in progress

This commit is contained in:
cimatosa 2016-01-25 16:31:03 +01:00
parent a3542b7f6c
commit de311fa7da
2 changed files with 23 additions and 16 deletions

View file

@ -124,17 +124,17 @@ class JobManager_Client(object):
"""
def __init__(self,
server,
authkey,
port=42524,
nproc=0,
njobs=0,
nice=19,
no_warnings=False,
verbose=1,
show_statusbar_for_jobs=True,
show_counter_only=False,
interval=0.3):
server,
authkey,
port=42524,
nproc=0,
njobs=0,
nice=19,
no_warnings=False,
verbose=1,
show_statusbar_for_jobs=True,
show_counter_only=False,
interval=0.3):
"""
server [string] - ip address or hostname where the JobManager_Server is running

View file

@ -8,6 +8,7 @@ import shutil
import traceback
import pickle
import warnings
import random
import progress
@ -50,6 +51,14 @@ def key_to_str(key, max_len = 255):
else:
return s
RAND_STR_ASCII_IDX_LIST = list(range(48,58)) + list(range(65,91)) + list(range(97,123))
def rand_str(l = 8):
s = ''
for i in range(l):
s += chr(random.choice(RAND_STR_ASCII_IDX_LIST))
return s
class PersistentDataStructure(object):
"""
@ -130,7 +139,6 @@ class PersistentDataStructure(object):
self.need_open()
c = 0
for key in self.db:
value = self.db[key]
if self.__is_sub_data(value):
@ -138,6 +146,7 @@ class PersistentDataStructure(object):
assert key in self.sub_data_keys
with self[key] as sub:
sub._consistency_check()
assert len(self.sub_data_keys) == c
@ -313,7 +322,6 @@ class PersistentDataStructure(object):
"""
try:
assert value['magic'] == MAGIC_SIGN
value.pop('magic')
return True
except:
return False
@ -337,12 +345,11 @@ class PersistentDataStructure(object):
return (key in self.db)
def is_subdata(self, key):
return key in self.sub_data_keys
# return self.__is_sub_data(self.db[key])
#return key in self.sub_data_keys
return self.__is_sub_data(self.db[key])
def is_NPA(self, key):
return key in self.nparray_keys
# return self.__is_sub_data(self.db[key])
def setData(self, key, value, overwrite=False):
"""