HCE Project Python language Distributed Tasks Manager Application, Distributed Crawler Application and client API bindings.  2.0.0-chaika
Hierarchical Cluster Engine Python language binding
app.Utils.InterruptableThread Class Reference
Inheritance diagram for app.Utils.InterruptableThread:
Collaboration diagram for app.Utils.InterruptableThread:

Public Member Functions

def __init__ (self, func, args, kwargs, default, log)
 
def run (self)
 

Public Attributes

 function
 
 args
 
 kwargs
 
 result
 
 logger
 
 errorCode
 
 errorMessage
 
 errorException
 

Static Public Attributes

int ERROR_CODE_OK = 0
 
int ERROR_CODE_GENERAL_EXCEPTION = 1
 
int ERROR_CODE_APPLIED_EXCEPTION = 2
 

Detailed Description

Definition at line 1503 of file Utils.py.

Constructor & Destructor Documentation

◆ __init__()

def app.Utils.InterruptableThread.__init__ (   self,
  func,
  args,
  kwargs,
  default,
  log 
)

Definition at line 1508 of file Utils.py.

1508  def __init__(self, func, args, kwargs, default, log):
1509  threading.Thread.__init__(self)
1510  self.function = func
1511  self.args = args
1512  self.kwargs = kwargs
1513  self.result = default
1514  self.logger = log
1515  self.errorCode = self.ERROR_CODE_OK
1516  self.errorMessage = ''
1517  self.errorException = Exception('Dummy exception')
def __init__(self)
constructor
Definition: UIDGenerator.py:19

Member Function Documentation

◆ run()

def app.Utils.InterruptableThread.run (   self)

Definition at line 1518 of file Utils.py.

1518  def run(self):
1519  try:
1520  self.result = self.function(*self.args, **self.kwargs)
1521  except Exception, err:
1522  if self.logger is not None:
1523  self.logger.error("Error of execution of thread class InterruptableThread(): %s\nargs: %s",
1524  str(err), str(self.args))
1525  self.errorCode = self.ERROR_CODE_APPLIED_EXCEPTION
1526  self.errorMessage = str(err)
1527  self.errorException = err
1528  raise err
1529  except:
1530  self.errorCode = self.ERROR_CODE_GENERAL_EXCEPTION
1531  self.errorMessage = 'Undefined error of execution of thread class InterruptableThread(), args: ' + str(self.args)
1532  if self.logger is not None:
1533  self.logger.error(self.errorMessage)
1534 
1535 
1536 # #The function to execute another function in a thread with limited time to run
1537 #
1538 # @param func to execute
1539 # @param args
1540 # @param kwargs
1541 # @param timeout - limit of execution time floating point, sec
1542 # @param default - value to return if execution time limit reached
1543 # @ret return value or default value
-mask-info

Member Data Documentation

◆ args

app.Utils.InterruptableThread.args

Definition at line 1511 of file Utils.py.

◆ ERROR_CODE_APPLIED_EXCEPTION

int app.Utils.InterruptableThread.ERROR_CODE_APPLIED_EXCEPTION = 2
static

Definition at line 1506 of file Utils.py.

◆ ERROR_CODE_GENERAL_EXCEPTION

int app.Utils.InterruptableThread.ERROR_CODE_GENERAL_EXCEPTION = 1
static

Definition at line 1505 of file Utils.py.

◆ ERROR_CODE_OK

int app.Utils.InterruptableThread.ERROR_CODE_OK = 0
static

Definition at line 1504 of file Utils.py.

◆ errorCode

app.Utils.InterruptableThread.errorCode

Definition at line 1515 of file Utils.py.

◆ errorException

app.Utils.InterruptableThread.errorException

Definition at line 1517 of file Utils.py.

◆ errorMessage

app.Utils.InterruptableThread.errorMessage

Definition at line 1516 of file Utils.py.

◆ function

app.Utils.InterruptableThread.function

Definition at line 1510 of file Utils.py.

◆ kwargs

app.Utils.InterruptableThread.kwargs

Definition at line 1512 of file Utils.py.

◆ logger

app.Utils.InterruptableThread.logger

Definition at line 1514 of file Utils.py.

◆ result

app.Utils.InterruptableThread.result

Definition at line 1513 of file Utils.py.


The documentation for this class was generated from the following file: