DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
ers.PyContext Class Reference
Inheritance diagram for ers.PyContext:
[legend]
Collaboration diagram for ers.PyContext:
[legend]

Public Member Functions

 __init__ (self, issue)
 

Public Attributes

list stack
 
 package_name = issue.__class__.__module__
 
list function_name = class_name() + self.stack[0].f_code.co_name;
 
list file_name = self.stack[0].f_code.co_filename
 
list line_number = self.stack[0].f_lineno
 
 host_name = platform.node()
 
 cwd = os.getcwd()
 
 process_id = os.getpid()
 
 thread_id = int(_thread.get_ident()%2**31)
 
 user_id = os.getuid()
 
 user_name = getpass.getuser()
 
 application_name = os.getenv( "DUNEDAQ_APPLICATION_NAME", "Undefined" )
 

Static Private Attributes

 __file = re.sub( r'\.pyc$', '.py', __file__ )
 

Detailed Description

Definition at line 15 of file __init__.py.

Constructor & Destructor Documentation

◆ __init__()

ers.PyContext.__init__ ( self,
issue )

Definition at line 19 of file __init__.py.

19 def __init__( self, issue ):
20 self.stack = [f[0] for f in inspect.stack() \
21 if f[1] != self.__file \
22 and ( 'self' not in f[0].f_locals\
23 or not isinstance(f[0].f_locals['self'], ers.PyIssue))]
24 self.package_name = issue.__class__.__module__
25 class_name = lambda : 'self' in self.stack[0].f_locals \
26 and self.stack[0].f_locals['self'].__class__.__name__ + '.'\
27 or ''
28
29 self.function_name = class_name() + self.stack[0].f_code.co_name;
30 try:
31 self.function_name += inspect.formatargvalues( *inspect.getargvalues(self.stack[0]) )
32 except Exception as exx:
33 self.function_name += '(...)'
34
35 self.file_name = self.stack[0].f_code.co_filename
36 self.line_number = self.stack[0].f_lineno
37 self.host_name = platform.node()
38 self.cwd = os.getcwd()
39 self.process_id = os.getpid()
40 # Need to truncate this to fit 32 bit signed int
41 self.thread_id = int(_thread.get_ident()%2**31)
42 self.user_id = os.getuid()
43 self.user_name = getpass.getuser()
44 self.application_name = os.getenv( "DUNEDAQ_APPLICATION_NAME", "Undefined" )
45
46

Member Data Documentation

◆ __file

ers.PyContext.__file = re.sub( r'\.pyc$', '.py', __file__ )
staticprivate

Definition at line 17 of file __init__.py.

◆ application_name

ers.PyContext.application_name = os.getenv( "DUNEDAQ_APPLICATION_NAME", "Undefined" )

Definition at line 44 of file __init__.py.

◆ cwd

ers.PyContext.cwd = os.getcwd()

Definition at line 38 of file __init__.py.

◆ file_name

list ers.PyContext.file_name = self.stack[0].f_code.co_filename

Definition at line 35 of file __init__.py.

◆ function_name

list ers.PyContext.function_name = class_name() + self.stack[0].f_code.co_name;

Definition at line 29 of file __init__.py.

◆ host_name

ers.PyContext.host_name = platform.node()

Definition at line 37 of file __init__.py.

◆ line_number

list ers.PyContext.line_number = self.stack[0].f_lineno

Definition at line 36 of file __init__.py.

◆ package_name

ers.PyContext.package_name = issue.__class__.__module__

Definition at line 24 of file __init__.py.

◆ process_id

ers.PyContext.process_id = os.getpid()

Definition at line 39 of file __init__.py.

◆ stack

list ers.PyContext.stack
Initial value:
= [f[0] for f in inspect.stack() \
if f[1] != self.__file \
and ( 'self' not in f[0].f_locals\
or not isinstance(f[0].f_locals['self'], ers.PyIssue))]

Definition at line 20 of file __init__.py.

◆ thread_id

ers.PyContext.thread_id = int(_thread.get_ident()%2**31)

Definition at line 41 of file __init__.py.

◆ user_id

ers.PyContext.user_id = os.getuid()

Definition at line 42 of file __init__.py.

◆ user_name

ers.PyContext.user_name = getpass.getuser()

Definition at line 43 of file __init__.py.


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