Acspy.Container
index
/alma/ACS-2016.6/ACSSW/lib/python/site-packages/Acspy/Container.py

This module includes the implementation of a Python Container for the
maci::Container IDL interface.
 
TODO LIST:
- integrate with the new ACS Error System
- fix the interfaces param to ComponentInfo in activate_component(...)
- a ComponentLifecycleException has been defined in IDL now...

 
Modules
       
ACS
Acspy.Util.ACSCorba
Acsalarmpy
Acspy.Common.Log
Logging
Acspy.Util.LoggingConfig_xsd
Logging__POA
omniORB.PortableServer
maci
maci__POA
sys

 
Classes
       
Acspy.Clients.BaseClient.BaseClient(maci__POA.Client)
Container(Acspy.Clients.BaseClient.BaseClient, maci__POA.Container, Logging__POA.LoggingConfigurable)
Acspy.Common.LogThrottleAlarmerBase.LogThrottleAlarmerBase(__builtin__.object)
ContainerLogThrottleAlarmer
Logging__POA.LoggingConfigurable(omniORB.PortableServer.Servant)
Container(Acspy.Clients.BaseClient.BaseClient, maci__POA.Container, Logging__POA.LoggingConfigurable)
maci__POA.Container(maci__POA.Client, Logging__POA.LoggingConfigurable, Logging__POA.ACSLogStatistics)
Container(Acspy.Clients.BaseClient.BaseClient, maci__POA.Container, Logging__POA.LoggingConfigurable)
threading.Thread(threading._Verbose)
AsyncComponentActivator

 
class AsyncComponentActivator(threading.Thread)
    This thread activates the component asynchronously by delegating to
Container#activate_component(...)
 
 
Method resolution order:
AsyncComponentActivator
threading.Thread
threading._Verbose
__builtin__.object

Methods defined here:
__init__(self, logger, container, h, execution_id, componentName, exe, type, callback, desc)
Constructor
 
Parameters:
- logger The logger
- container A reference to the container
- h is the handle the component will be given
- name is simply the components name
- exe is the name of the Python module that has to be imported for the
      components implementation
- idl_type is the the IR Location for the component
- callback To callback to notify that the component has been activated 
           or report an error
run(self)

Methods inherited from threading.Thread:
__repr__(self)
getName(self)
isAlive(self)
Return whether the thread is alive.
 
This method returns True just before the run() method starts until just
after the run() method terminates. The module function enumerate()
returns a list of all alive threads.
isDaemon(self)
is_alive = isAlive(self)
Return whether the thread is alive.
 
This method returns True just before the run() method starts until just
after the run() method terminates. The module function enumerate()
returns a list of all alive threads.
join(self, timeout=None)
Wait until the thread terminates.
 
This blocks the calling thread until the thread whose join() method is
called terminates -- either normally or through an unhandled exception
or until the optional timeout occurs.
 
When the timeout argument is present and not None, it should be a
floating point number specifying a timeout for the operation in seconds
(or fractions thereof). As join() always returns None, you must call
isAlive() after join() to decide whether a timeout happened -- if the
thread is still alive, the join() call timed out.
 
When the timeout argument is not present or None, the operation will
block until the thread terminates.
 
A thread can be join()ed many times.
 
join() raises a RuntimeError if an attempt is made to join the current
thread as that would cause a deadlock. It is also an error to join() a
thread before it has been started and attempts to do so raises the same
exception.
setDaemon(self, daemonic)
setName(self, name)
start(self)
Start the thread's activity.
 
It must be called at most once per thread object. It arranges for the
object's run() method to be invoked in a separate thread of control.
 
This method will raise a RuntimeError if called more than once on the
same thread object.

Data descriptors inherited from threading.Thread:
daemon
A boolean value indicating whether this thread is a daemon thread (True) or not (False).
 
This must be set before start() is called, otherwise RuntimeError is
raised. Its initial value is inherited from the creating thread; the
main thread is not a daemon thread and therefore all threads created in
the main thread default to daemon = False.
 
The entire Python program exits when no alive non-daemon threads are
left.
ident
Thread identifier of this thread or None if it has not been started.
 
This is a nonzero integer. See the thread.get_ident() function. Thread
identifiers may be recycled when a thread exits and another thread is
created. The identifier is available even after the thread has exited.
name
A string used for identification purposes only.
 
It has no semantics. Multiple threads may be given the same name. The
initial name is set by the constructor.

Data descriptors inherited from threading._Verbose:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class Container(Acspy.Clients.BaseClient.BaseClient, maci__POA.Container, Logging__POA.LoggingConfigurable)
    The Python implementation of a MACI Container.
 
This implies it implements both the Container and Client interfaces. It is
multi-threaded and currently supports components derived from
ACSComponent, ContainerServices, and the LifeCycle classes.
 
 
Method resolution order:
Container
Acspy.Clients.BaseClient.BaseClient
maci__POA.Container
maci__POA.Client
Logging__POA.LoggingConfigurable
Logging__POA.ACSLogStatistics
omniORB.PortableServer.Servant
__builtin__.object

Methods defined here:
__init__(self, name)
Constructor.
 
Initializes member variables and CORBA
 
Parameters: name is the stringified name of this container.
 
Raises: ???
activateOffShoot(self, comp_name, os_corba_ref)
Activates an OffShoot derived object.
 
Actually this will work on any CORBA object because its Python.
 
Parameters:
- comp_name is the components name.
- os_corba_ref is a reference to the Python object to become a CORBA object.
 
Return: a reference to the CORBA object that almost definitely needs to
be narrowed to the correct type.  If anything goes wrong though, returns
None.
 
Raises: ???
activate_component(self, h, exeid, name, exe, idl_type)
Activates a component (or returns a reference to it if already exists).
 
Parameters:
- h is the handle the component will be given
- name is simply the components name
- exe is the name of the Python module that has to be imported for the
components implementation
- idl_type is the the IR Location for the component
 
Raises: CannotActivateComponentExImpl exception when invalid
 
Returns: a ComponentInfo structure for manager to use.
 
activate_component(in Handle h,in string name,in string exe,in string idl_type)
activate_component_async(self, h, execution_id, name, exe, type, callback, desc)
Activates a component asynchronously.
 
Parameters:
- h is the handle the component will be given
- name is simply the components name
- exe is the name of the Python module that has to be imported for the
      components implementation
- idl_type is the the IR Location for the component
- callback To callback to notify that the component has been activated 
           or report an error
configCORBA(self)
configCORBA is a helper method responsible for initializing the ORB,
POAs, etc.
 
Parameters: None
 
Return: None
 
Raises: ???
configureComponentLogger(self, name)
Configure the logger for the given component name from the values in the CDB.
 
Parameters:
name is the name of the component
createPOAForComponent(self, comp_name)
Creates a new POA that is responsible for exactly one component and
the new POA is created as a child of the ComponentPOA.
 
Parameters: comp_name is the components stringified name.
 
Return: a new POA.
 
Raises: ???
deactivate_component(self, handle)
Deactivate all components whose handles are given.
 
Deactivation is the inverse process of activation: component is detached from
the POA, and thus made unavailable through CORBA, and its resources are
freed. If its code-base is no longer used, it is unloaded from memory.
 
Parameters: handle, specifies a component handle
 
void deactivate_component (in Handle h)
destroyCORBA(self)
Helper function designed to shutdown/destroy all CORBA associated with
this specific container.
 
Raises: ???
disconnect(self)
Disconnect from manager.
 
oneway void disconnect ();
 
The container overrides BaseClient.disconnect() because it tries 
to reconnect to the manager.
failedActivation(self, comp_entry)
Helper method used to destroy various things if the component cannot
be created.
 
Mutual exclusion is ensured by self.activationMap that 
serializes activation/deactivation of components with the same name
 
Parameters:
comp_entry - dictionary describing the component
getCDBInfo(self)
getCDBInfo is a helper method which is responsible for retrieving info
from the CDB associated with this container.
 
Parameters: None
 
Return: None
 
Raises: ???
getCode(self)
Overriden from BaseClient
getExistingComponent(self, name)
Searches to see if the component "name" has already been activated by
this container.
 
Parameters: name of the component.
 
Return: component record if found; else None.
getManagerHost(self)
Helper function returns a string consisting of managers host.
 
Return: hostname where manager is running.
 
Raises: ???
getMyCorbaRef(self)
Overriden from BaseClient
get_component_info(self, handles)
Returns information about a subset of components that are currently hosted by
the Container.
 
Note:  If the list of handles is empty, information about all components hosted
by the activator is returned!
 
Parmaters: handles is a sequence of integers specifiying component handles.
Return: Information about the selected components.
 
ComponentInfoSeq get_component_info (in HandleSeq h);
get_default_logLevels(self)
Retrieve the default log levels used in this container.
 
Returns: Logging.LoggingConfigurable.LogLevels instance containing default log level values
 
Raises: Nothing
get_handle(self)
Returns the handle of this container given by the manager at login.
 
Parameters: None
 
Returns: handle, 0 if not (yet) logged in.
 
Raises: Nothing
 
Handle get_handle();
get_logLevels(self, logger_name)
Retrieve the log levels for a given component.
 
Parameter:
logger_name - name of the component's logger
 
Returns: Logging.LoggingConfigurable.LogLevels instance containing the logger's log level values
 
Raises: Logging.LoggerDoesNotExistEx if the logger is not active.
get_logger_names(self)
Retrieve the names of the currently active loggers
 
Returns: list of logger name strings
get_statistics_logger_configuration(self)
Gets the names and status of all statistics modules of all loggers, to allow configuring them individually.
If the logger statistics module has never been configured yet, then it will provide "Undefined"
as elementName
get_statistics_logger_configuration_byname(self, logger_name)
Gets the names and status of statistics module of requested logger.
If the logger statistics module has never been configured yet, then it will provide "Undefined"
as elementName 
Throws LoggerDoesNotExistEx if a the logger is not found
handler(self, signum, frame)
Catches SIGINTs and shuts down the container.
 
Used only by the run method.
 
Parameters: signum is the signal being caught
frame is the execution frame.
 
Return: None
 
Raises: ???
refresh_logging_config(self)
Reset the logging configuration to the original CDB settings.
 
Returns:  Nothing
 
Raises:  Nothing
run(self)
Runs the container until a sig-int is caught.
 
This is a blocking call!
 
Raises: ???
sendAlarm(self, family, member, code, active)
Raise or clear an alarm with the passed triplet
 
family: FaultFamily
member: FaultMember
code: FaultCode
active: if True raise the alarm otherwise clear the alarm
setToken(self, newToken)
Override BaseClient.setToken to handle the case of
a failure connecting to the manager
set_component_shutdown_order(self, handles)
Set component shutdown order.
 
void set_component_shutdown_order(in HandleSeq h);
set_default_logLevels(self, levels)
Set the default log level for this container.
 
Parameter:
levels - Logging.LoggingConfigurable.LogLevels instance containing default log level values
 
Raises: Nothing
set_logLevels(self, logger_name, levels)
Set the default log level for this component.
 
Parameter:
logger_name - name of the component's logger
levels - Logging.LoggingConfigurable.LogLevels instance containing default log level values
 
Raises: Logging.LoggerDoesNotExistEx if the logger is not active.
set_statistics_logger_configuration_byname(self, logger_name, statsInformation)
Sets logger statistics configuration for a particular named logger.
Throws LoggerDoesNotExistEx if a the logger is not found
shutdown(self, action)
Shutdown the Container.
 
Normally invoked via CORBA but can also "self terminate" so to speak.
 
Parameters:
- action is an encrypted value that tells the container what action to take
 
oneway void shutdown (in unsigned long action)
taggedmessage(self, message_type, message_id, message)
The Manager and administrators use this method for sending textual messages
to the client.
 
This implementation first attempts to use the ACS logging mechanism to
display the message and if that fails for any reason, it is only sent
to standard out.
 
Parameters:
- message_type is an integer defined as a constant in the Client interface
- message is a string
 
Returns: Nothing
 
Raises: Nothing
 
oneway void message (in short message_type, in string message)

Methods inherited from Acspy.Clients.BaseClient.BaseClient:
authenticate(self, execution_id, question)
Authentication method. Method authenticate is the challenge issued to
the client after it tries to login. The login will be successful if the
clients authenticate() produces the expected result. Only in this case
will the Managers login method return a valid handle, which the client
will later use as the id parameter with all calls to the Manager.
 
Parameters: question this string does not currently matter
 
Return Answer - first character of the answer identifies the type of
the client, and can be one of:
- C = a regular client (implements just the Client interface).
- A = a container (implements the Container interface).
- AR = a container with recovery capability (implements the Container interface).
- S = Supervisor (implements the Administrator interface).
 
Raises: Nothing
 
string authenticate (in string question);
components_available(self, components)
Notify client about the change (availability) of the components currently
in use by this client. For administrative clients, notification is issued
for the change of availability of any component in the domain.
 
Parameters:
- components is a sequence of ComponentInfo structures
 
Returns: None
 
Raises: Nothing
 
oneway void components_available(in ComponentInfoSeq components)
components_unavailable(self, component_names)
Notify client that some of the Components currently in use by client
have become unavailable.
 
Parameters:
- component_names names of various unavailable components
 
Returns: None
 
Raises: Nothing
 
oneway void Components_unavailable (in stringSeq component_names)
isLoggedIn(self)
Returns True is the client is logged into the manager
and False otherwise
 
Parameters: None
 
Raises: Nothing
managerLogin(self)
Login into the manager
 
Parameters: None
 
Returns: The token received from the manager
 
Raises: CORBAProblemExImpl If the login failed
managerLogout(self)
Logout from manager
 
Parameters: None
 
Returns: None
 
Raises: Nothing
message(self, message_type, message)
The Manager and administrators use this method for sending textual messages
to the client.
 
This implementation first attempts to use the ACS logging mechanism to
display the message and if that fails for any reason, it is only sent
to standard out.
 
Parameters:
- message_type is an integer defined as a constant in the Client interface
- message is a string
 
Returns: Nothing
 
Raises: Nothing
 
oneway void message (in short message_type, in string message)
ping(self)
Manager pings its clients to verify they still exist.
 
Parameters: None
 
Returns: CORBA.TRUE (i.e., 1)
 
Raises: Nothing
 
boolean ping ();

Data descriptors inherited from omniORB.PortableServer.Servant:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class ContainerLogThrottleAlarmer(Acspy.Common.LogThrottleAlarmerBase.LogThrottleAlarmerBase)
    #------------------------------------------------------------------------------
 
 
Method resolution order:
ContainerLogThrottleAlarmer
Acspy.Common.LogThrottleAlarmerBase.LogThrottleAlarmerBase
__builtin__.object

Methods defined here:
__init__(self, cont)
cont Is the container to invoke sendAlarm to send alarms
sendThrottleAlarm(self, active)
See Log.LogThrottleAlarmerBase

Data and other attributes defined here:
__abstractmethods__ = frozenset([])

Data descriptors inherited from Acspy.Common.LogThrottleAlarmerBase.LogThrottleAlarmerBase:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes inherited from Acspy.Common.LogThrottleAlarmerBase.LogThrottleAlarmerBase:
__metaclass__ = <class 'abc.ABCMeta'>
Metaclass for defining Abstract Base Classes (ABCs).
 
Use this metaclass to create an ABC.  An ABC can be subclassed
directly, and then acts as a mix-in class.  You can also register
unrelated concrete classes (even built-in classes) and unrelated
ABCs as 'virtual subclasses' -- these and their descendants will
be considered subclasses of the registering ABC by the built-in
issubclass() function, but the registering ABC won't show up in
their MRO (Method Resolution Order) nor will method
implementations defined by the registering ABC be callable (not
even via super()).

 
Functions
       
signal(...)
signal(sig, action) -> action
 
Set the action for the given signal.  The action can be SIG_DFL,
SIG_IGN, or a callable Python object.  The previous action is
returned.  See getsignal() for possible return values.
 
*** IMPORTANT NOTICE ***
A signal handler function is called with two arguments:
the first is the signal number, the second is the interrupted stack frame.
sleep(...)
sleep(seconds)
 
Delay execution for a given number of seconds.  The argument may be
a floating point number for subsecond precision.
time(...)
time() -> floating point number
 
Return the current time in seconds since the Epoch.
Fractions of a second may be present if the system clock provides them.

 
Data
        ACTIVATOR_EXIT = 2
ACTIVATOR_REBOOT = 1
ACTIVATOR_RELOAD = 0
COMPMODULE = 'COMPMODULE'
COMPONENTINFO = 'COMPONENTINFO'
CORBAREF = 'CORBAREF'
EXE = 'EXE'
EXEID = 'EXEID'
FALSE = False
HANDLE = 'HANDLE'
NAME = 'NAME'
POA = 'POA'
POAOFFSHOOT = 'POAOFFSHOOT'
PYCLASS = 'PYCLASS'
PYREF = 'PYREF'
SIGINT = 2
TYPE = 'TYPE'
__revision__ = '$Id: Container.py,v 1.59 2012/06/21 15:24:08 acaproni Exp $'
environ = {'ACS_CDB': '/alma/ACS-2016.6/acsdata/config/def....spx=38;5;45:*.xspf=38;5;45:', 'USER': 'almamgr'}