fix for linux

This commit is contained in:
Colombo 2020-02-29 14:49:46 +04:00
parent dbf28eeebf
commit 7f609d0f0a
5 changed files with 31 additions and 41 deletions

View file

@ -55,17 +55,12 @@ class Subprocessor(object):
def progress_bar_inc(self, c): self.c2s.put ( {'op': 'progress_bar_inc' , 'c':c } )
def _subprocess_run(self, client_dict, s2c, c2s):
import sys
if sys.platform != 'win32':
# fix for Linux , Ignoring :
# /usr/lib/python3.6/multiprocessing/semaphore_tracker.py:143:
# UserWarning: semaphore_tracker: There appear to be 1 leaked semaphores to clean up at shutdown
import warnings
warnings.simplefilter(action='ignore', category=UserWarning)
self.s2c = s2c
from core import osex
osex.linux_ignore_UserWarning()
self.c2s = c2s
data = None
is_error = False
try:
self.on_initialize(client_dict)
@ -85,17 +80,19 @@ class Subprocessor(object):
time.sleep(0.001)
self.on_finalize()
c2s.put ( {'op': 'finalized'} )
return
c2s.put ( {'op': 'finalized'} )
except Subprocessor.SilenceException as e:
pass
c2s.put ( {'op': 'error', 'data' : data} )
except Exception as e:
c2s.put ( {'op': 'error', 'data' : data} )
if data is not None:
print ('Exception while process data [%s]: %s' % (self.get_data_name(data), traceback.format_exc()) )
else:
print ('Exception: %s' % (traceback.format_exc()) )
c2s.put ( {'op': 'error', 'data' : data} )
c2s.close()
s2c.close()
self.c2s = None
# disable pickling
def __getstate__(self):