fixed bugs with groups and reading bin files with pickle

master
idziubenko 3 years ago
parent e4342187eb
commit 2bb7a6366f

@ -91,7 +91,7 @@ def search_worked_process2(clVars, filter_func=lambda x: True,
pids = clVars.Get('core.cl_core_pids_path')
for pidfile in listDirectory(pids, fullPath=True):
try:
status = pickle.load(open(pidfile), "rb")
status = pickle.load(open(pidfile, "rb"))
if status_filter(status) and filter_func(status):
pid_path = path.join("/proc", str(status['os_pid']))
if path.exists(pid_path):
@ -112,7 +112,7 @@ def get_pid_info(clVars, statuses=(ProcessStatus.Worked,)):
pids = clVars.Get('core.cl_core_pids_path')
for pidfile in listDirectory(pids, fullPath=True):
try:
status = pickle.load(open(pidfile), "rb")
status = pickle.load(open(pidfile, "rb"))
if status['status'] in statuses:
if path.exists(path.join("/proc", str(status['os_pid']))):
yield status
@ -123,7 +123,7 @@ def get_pid_info(clVars, statuses=(ProcessStatus.Worked,)):
# try:
# pidfile = path.join(pids,str(pid))
# status = pickle.load(open(pidfile), "rb")
# status = pickle.load(open(pidfile,"rb"))
# return status
# except (socket.error, ValueError, IOError, KeyError, EOFError, OSError):
# return None
@ -136,7 +136,7 @@ def clear_finished_pids(clVars):
pids = clVars.Get('core.cl_core_pids_path')
for pidfile in listDirectory(pids, fullPath=True):
try:
d = pickle.load(open(pidfile), "rb")
d = pickle.load(open(pidfile, "rb"))
if path.exists(path.join("/proc", str(d['os_pid']))):
continue
except Exception:

@ -45,7 +45,11 @@ class Groups(MethodsInterface):
body = []
fields = ['cl_core_group', '']
print("DEBUG show groups meth")
print(list_group_name)
for group in list_group_name[page_offset:page_offset + page_count]:
print("(for) ", group)
dv.Set('cl_core_group', group)
group_rights = ', '.join(dv.Get('cl_core_group_rights'))
body.append([group, group_rights])

@ -304,14 +304,12 @@ class ClApplication(WsgiApplication):
"""
if (not "wsgi.input" in http_req_env):
return None
# print("DEBUG")
# print(http_req_env)
length = http_req_env.get("CONTENT_LENGTH")
if(not length):
return None
input = http_req_env["wsgi.input"]
body = input.read(int(length))
print(body)
res = re.search(b"<ns.:sid>(.*?)<\/ns.:sid>", body)
#horrbile hack:
#cherrypy provides rfile in req_env which is consumed upon .read() without

@ -63,14 +63,19 @@ class VariableClCoreGroup(Variable):
'digits and underline symbols') + '\n' +
_('The group name must consist of 2 to 20 symbols'))
group_rights = self.Get('cl_core_group_rights_path')
print("DEBUG GROUP")
print(group_rights)
print(group)
if group == 'all':
return
t = readFile(group_rights)
print(t)
find = False
for line in t.splitlines():
print("line: ", line)
words = line.split()
if words[0].startswith('#'):
print("words: ", words)
if not words or words[0].startswith('#'):
continue
if group == words[0]:
find = True

Loading…
Cancel
Save