Package x2go :: Module registry :: Class X2GoSessionRegistry
[frames] | no frames]

Class X2GoSessionRegistry

source code

object --+
         |
        X2GoSessionRegistry

This class is utilized by X2GoClient instances to maintain a good overview on session status of all associated X2GoSession instances.

Instance Methods
 
__init__(self, client_instance, logger=None, loglevel=56)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
list
keys(self)
A list of session registry keys.
source code
 
__repr__(self)
repr(x)
source code
X2GoSession instance
__call__(self, session_uuid)
Returns the X2GoSession instance for a given session UUID hash.
source code
 
disable_session_auto_registration(self)
This method is used to temporarily skip auto-registration of newly appearing X2Go session on the server side.
source code
 
enable_session_auto_registration(self)
This method is used to temporarily (re-)enable auto-registration of newly appearing X2Go session on the server side.
source code
 
forget(self, session_uuid)
Forget the complete record for session UUID session_uuid.
source code
str
get_profile_id(self, session_uuid)
Retrieve the profile ID of a given session UUID hash.
source code
str
get_profile_name(self, session_uuid)
Retrieve the profile name of a given session UUID hash.
source code
dict
session_summary(self, session_uuid, status_only=False)
Compose a session summary (as Python dictionary).
source code
bool
update_status(self, session_uuid=None, profile_name=None, profile_id=None, session_list=None, force_update=False, newly_connected=False)
Update the session status for X2GoSession that is represented by a given session UUID hash, profile name or profile ID.
source code
 
register_available_server_sessions(self, profile_name, session_list=None, newly_connected=False, re_register=False, skip_pubapp_sessions=False)
Register server-side available X2Go sessions with this X2GoSessionRegistry instance for a given profile name.
source code
str
register(self, server, profile_id, profile_name, session_name=None, control_backend=<class 'x2go.backends.control._stdout.X2GoControlSessionSTDOUT'>, terminal_backend=<class 'x2go.backends.terminal._stdout.X2GoTerminalSessionSTDO..., info_backend=<class 'x2go.backends.info._stdout.X2GoServerSessionInfoSTDOUT'>, list_backend=<class 'x2go.backends.info._stdout.X2GoServerSessionListSTDOUT'>, proxy_backend=<class 'x2go.backends.proxy._nx3.X2GoProxyNX3'>, settings_backend=<class 'x2go.backends.settings._file.X2GoClientSettingsFILE'>, printing_backend=<class 'x2go.backends.printing._file.X2GoClientPrintingFILE'>, client_rootdir='/builddir/.x2goclient', sessions_rootdir='/builddir/.x2go', ssh_rootdir='/builddir/.ssh', keep_controlsession_alive=True, add_to_known_hosts=False, known_hosts=None, **kwargs)
Register a new X2GoSession instance with this X2GoSessionRegistry.
source code
bool
has_session_of_session_name(self, session_name, match_profile_name=None)
Detect if we know about an X2GoSession of name <session_name>.
source code
X2GoSession instance or str
get_session_of_session_name(self, session_name, return_object=False, match_profile_name=None)
Retrieve the X2GoSession instance with session name <session_name>.
source code
list
connected_sessions(self, return_objects=True, return_profile_names=False, return_profile_ids=False, return_session_names=False)
Retrieve a list of sessions that the underlying X2GoClient instances is currently connected to.
source code
list
associated_sessions(self, return_objects=True, return_profile_names=False, return_profile_ids=False, return_session_names=False)
Retrieve a list of sessions that are currently associated by an X2GoTerminalSession* to the underlying X2GoClient instance.
source code
list
virgin_sessions(self, return_objects=True, return_profile_names=False, return_profile_ids=False, return_session_names=False)
Retrieve a list of sessions that are currently still in virgin state (not yet connected, associated etc.).
source code
list
running_sessions(self, return_objects=True, return_profile_names=False, return_profile_ids=False, return_session_names=False)
Retrieve a list of sessions that are currently in running state.
source code
list
suspended_sessions(self, return_objects=True, return_profile_names=False, return_profile_ids=False, return_session_names=False)
Retrieve a list of sessions that are currently in suspended state.
source code
list
terminated_sessions(self, return_objects=True, return_profile_names=False, return_profile_ids=False, return_session_names=False)
Retrieve a list of sessions that have terminated recently.
source code
list
registered_sessions(self, return_objects=True, return_profile_names=False, return_profile_ids=False, return_session_names=False)
Retrieve a list of all registered sessions.
source code
list
non_running_sessions(self, return_objects=True, return_profile_names=False, return_profile_ids=False, return_session_names=False)
Retrieve a list of sessions that are currently _NOT_ in running state.
source code
list
connected_sessions_of_profile_name(self, profile_name, return_objects=True, return_session_names=False)
For a given session profile name retrieve a list of sessions that are currently connected to the profile's X2Go server.
source code
list
associated_sessions_of_profile_name(self, profile_name, return_objects=True, return_session_names=False)
For a given session profile name retrieve a list of sessions that are currently associated by an X2GoTerminalSession* to this X2GoClient instance.
source code
list
pubapp_sessions_of_profile_name(self, profile_name, return_objects=True, return_session_names=False)
For a given session profile name retrieve a list of sessions that can be providers for published application list.
source code
list
registered_sessions_of_profile_name(self, profile_name, return_objects=True, return_session_names=False)
For a given session profile name retrieve a list of sessions that are currently registered with this X2GoClient instance.
source code
list
virgin_sessions_of_profile_name(self, profile_name, return_objects=True, return_session_names=False)
For a given session profile name retrieve a list of sessions that are registered with this X2GoClient instance but have not yet been started (i.e.
source code
list
running_sessions_of_profile_name(self, profile_name, return_objects=True, return_session_names=False)
For a given session profile name retrieve a list of sessions that are currently running.
source code
list
suspended_sessions_of_profile_name(self, profile_name, return_objects=True, return_session_names=False)
For a given session profile name retrieve a list of sessions that are currently in suspended state.
source code
X2GoControlSession* instance
control_session_of_profile_name(self, profile_name)
For a given session profile name retrieve a the corresponding X2GoControlSession* instance.
source code
list
connected_profiles(self, use_paramiko=False, return_profile_ids=True, return_profile_names=False)
Retrieve a list of all currently connected session profiles.
source code
list
get_master_session(self, profile_name, return_object=True, return_session_name=False)
Retrieve the master session of a specific profile.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties
  has_running_sessions
Equals True if the underlying X2GoClient instance has any running sessions at hand.
  has_suspended_sessions
Equals True if the underlying X2GoClient instance has any suspended sessions at hand.
  connected_control_sessions
Equals a list of all currently connected control sessions.

Inherited from object: __class__

Method Details

__init__(self, client_instance, logger=None, loglevel=56)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Parameters:
Overrides: object.__init__

keys(self)

source code 

A list of session registry keys.

Returns: list
session registry key list

__repr__(self)
(Representation operator)

source code 

repr(x)

Overrides: object.__repr__
(inherited documentation)

__call__(self, session_uuid)
(Call operator)

source code 

Returns the X2GoSession instance for a given session UUID hash.

Parameters:
  • session_uuid (str) - the X2Go session's UUID registry hash
Returns: X2GoSession instance
the corresponding X2GoSession instance
Raises:

disable_session_auto_registration(self)

source code 

This method is used to temporarily skip auto-registration of newly appearing X2Go session on the server side. This is necessary during session startups to assure that the session registry does not get filled with session UUID duplicates.

forget(self, session_uuid)

source code 

Forget the complete record for session UUID session_uuid.

Parameters:
  • session_uuid (str) - the X2Go session's UUID registry hash

get_profile_id(self, session_uuid)

source code 

Retrieve the profile ID of a given session UUID hash.

Parameters:
  • session_uuid (str) - the X2Go session's UUID registry hash
Returns: str
profile ID

get_profile_name(self, session_uuid)

source code 

Retrieve the profile name of a given session UUID hash.

Parameters:
  • session_uuid (str) - the X2Go session's UUID registry hash
Returns: str
profile name

session_summary(self, session_uuid, status_only=False)

source code 

Compose a session summary (as Python dictionary).

Parameters:
  • session_uuid (str) - the X2Go session's UUID registry hash
Returns: dict
session summary dictionary

update_status(self, session_uuid=None, profile_name=None, profile_id=None, session_list=None, force_update=False, newly_connected=False)

source code 

Update the session status for X2GoSession that is represented by a given session UUID hash, profile name or profile ID.

Parameters:
  • session_uuid (str) - the X2Go session's UUID registry hash
  • profile_name (str) - alternatively, a profile name can be specified (the stati of all registered sessions for this session profile will be updated)
  • profile_id (str) - alternatively, a profile ID can be given (the stati of all registered sessions for this session profile will be updated)
  • session_list (X2GoServerSessionList* instance) - an optional X2GoServerSessionList* instance (as returned by the X2GoClient.list_sessions() command can be passed to this method.
  • force_update (bool) - make sure the session status gets really updated
Returns: bool
True if this method has been successful
Raises:
  • X2GoSessionRegistryException - if the combination of session_uuid, profile_name and profile_id does not match the requirement: only one of them

register_available_server_sessions(self, profile_name, session_list=None, newly_connected=False, re_register=False, skip_pubapp_sessions=False)

source code 

Register server-side available X2Go sessions with this X2GoSessionRegistry instance for a given profile name.

Parameters:
  • profile_name (str) - session profile name to register available X2Go sessions for
  • session_list (X2GoServerSessionList* instance) - an optional X2GoServerSessionList* instance (as returned by the X2GoClient.list_sessions() command can be passed to this method.
  • newly_connected (bool) - give a hint that the session profile got newly connected
  • re_register (bool) - re-register available sessions, needs to be done after changes to the session profile
  • skip_pubapp_sessions (bool) - Do not register published applications sessions

register(self, server, profile_id, profile_name, session_name=None, control_backend=<class 'x2go.backends.control._stdout.X2GoControlSessionSTDOUT'>, terminal_backend=<class 'x2go.backends.terminal._stdout.X2GoTerminalSessionSTDO..., info_backend=<class 'x2go.backends.info._stdout.X2GoServerSessionInfoSTDOUT'>, list_backend=<class 'x2go.backends.info._stdout.X2GoServerSessionListSTDOUT'>, proxy_backend=<class 'x2go.backends.proxy._nx3.X2GoProxyNX3'>, settings_backend=<class 'x2go.backends.settings._file.X2GoClientSettingsFILE'>, printing_backend=<class 'x2go.backends.printing._file.X2GoClientPrintingFILE'>, client_rootdir='/builddir/.x2goclient', sessions_rootdir='/builddir/.x2go', ssh_rootdir='/builddir/.ssh', keep_controlsession_alive=True, add_to_known_hosts=False, known_hosts=None, **kwargs)

source code 

Register a new X2GoSession instance with this X2GoSessionRegistry.

Parameters:
  • server (str) - hostname of X2Go server
  • profile_id (str) - profile ID
  • profile_name (str) - profile name
  • session_name (str) - session name (if available)
  • control_backend (class) - X2Go control session backend to use
  • terminal_backend (class) - X2Go terminal session backend to use
  • info_backend (class) - X2Go session info backend to use
  • list_backend (class) - X2Go session list backend to use
  • proxy_backend (class) - X2Go proxy backend to use
  • settings_backend (class) - X2Go client settings backend to use
  • printing_backend (class) - X2Go client printing backend to use
  • client_rootdir (str) - client base dir (default: ~/.x2goclient)
  • sessions_rootdir (str) - sessions base dir (default: ~/.x2go)
  • ssh_rootdir (str) - ssh base dir (default: ~/.ssh)
  • keep_controlsession_alive - On last X2GoSession.disconnect() keep the associated X2GoControlSession* instance alive? @ŧype keep_controlsession_alive: bool
  • add_to_known_hosts (bool) - Auto-accept server host validity?
  • known_hosts (str) - the underlying Paramiko/SSH systems known_hosts file
  • kwargs - all other options will be passed on to the constructor of the to-be-instantiated X2GoSession instance @type dict
Returns: str
the session UUID of the newly registered (or re-registered) session

has_session_of_session_name(self, session_name, match_profile_name=None)

source code 

Detect if we know about an X2GoSession of name <session_name>.

Parameters:
  • session_name (str) - name of session to be searched for
  • match_profile_name (str) - a session's profile_name must match this profile name
Returns: bool
True if a session of <session_name> has been found

get_session_of_session_name(self, session_name, return_object=False, match_profile_name=None)

source code 

Retrieve the X2GoSession instance with session name <session_name>.

Parameters:
  • session_name (str) - name of session to be retrieved
  • return_object (bool) - if False the session UUID hash will be returned, if True the X2GoSession instance will be returned
  • match_profile_name (str) - returned sessions must match this profile name
Returns: X2GoSession instance or str
X2GoSession object or its representing session UUID hash
Raises:

connected_sessions(self, return_objects=True, return_profile_names=False, return_profile_ids=False, return_session_names=False)

source code 

Retrieve a list of sessions that the underlying X2GoClient instances is currently connected to. If none of the return_* options is specified a list of session UUID hashes will be returned.

Parameters:
  • return_objects (bool) - return as list of X2GoSession instances
  • return_profile_names (bool) - return as list of profile names
  • return_profile_ids (bool) - return as list of profile IDs
  • return_session_names (bool) - return as list of X2Go session names
Returns: list
a session list (as UUID hashes, objects, profile names/IDs or session names)

associated_sessions(self, return_objects=True, return_profile_names=False, return_profile_ids=False, return_session_names=False)

source code 

Retrieve a list of sessions that are currently associated by an X2GoTerminalSession* to the underlying X2GoClient instance. If none of the return_* options is specified a list of session UUID hashes will be returned.

Parameters:
  • return_objects (bool) - return as list of X2GoSession instances
  • return_profile_names (bool) - return as list of profile names
  • return_profile_ids (bool) - return as list of profile IDs
  • return_session_names (bool) - return as list of X2Go session names
Returns: list
a session list (as UUID hashes, objects, profile names/IDs or session names)

virgin_sessions(self, return_objects=True, return_profile_names=False, return_profile_ids=False, return_session_names=False)

source code 

Retrieve a list of sessions that are currently still in virgin state (not yet connected, associated etc.). If none of the return_* options is specified a list of session UUID hashes will be returned.

Parameters:
  • return_objects (bool) - return as list of X2GoSession instances
  • return_profile_names (bool) - return as list of profile names
  • return_profile_ids (bool) - return as list of profile IDs
  • return_session_names (bool) - return as list of X2Go session names
Returns: list
a session list (as UUID hashes, objects, profile names/IDs or session names)

running_sessions(self, return_objects=True, return_profile_names=False, return_profile_ids=False, return_session_names=False)

source code 

Retrieve a list of sessions that are currently in running state. If none of the return_* options is specified a list of session UUID hashes will be returned.

Parameters:
  • return_objects (bool) - return as list of X2GoSession instances
  • return_profile_names (bool) - return as list of profile names
  • return_profile_ids (bool) - return as list of profile IDs
  • return_session_names (bool) - return as list of X2Go session names
Returns: list
a session list (as UUID hashes, objects, profile names/IDs or session names)

suspended_sessions(self, return_objects=True, return_profile_names=False, return_profile_ids=False, return_session_names=False)

source code 

Retrieve a list of sessions that are currently in suspended state. If none of the return_* options is specified a list of session UUID hashes will be returned.

Parameters:
  • return_objects (bool) - return as list of X2GoSession instances
  • return_profile_names (bool) - return as list of profile names
  • return_profile_ids (bool) - return as list of profile IDs
  • return_session_names (bool) - return as list of X2Go session names
Returns: list
a session list (as UUID hashes, objects, profile names/IDs or session names)

terminated_sessions(self, return_objects=True, return_profile_names=False, return_profile_ids=False, return_session_names=False)

source code 

Retrieve a list of sessions that have terminated recently. If none of the return_* options is specified a list of session UUID hashes will be returned.

Parameters:
  • return_objects (bool) - return as list of X2GoSession instances
  • return_profile_names (bool) - return as list of profile names
  • return_profile_ids (bool) - return as list of profile IDs
  • return_session_names (bool) - return as list of X2Go session names
Returns: list
a session list (as UUID hashes, objects, profile names/IDs or session names)

registered_sessions(self, return_objects=True, return_profile_names=False, return_profile_ids=False, return_session_names=False)

source code 

Retrieve a list of all registered sessions. If none of the return_* options is specified a list of session UUID hashes will be returned.

Parameters:
  • return_objects (bool) - return as list of X2GoSession instances
  • return_profile_names (bool) - return as list of profile names
  • return_profile_ids (bool) - return as list of profile IDs
  • return_session_names (bool) - return as list of X2Go session names
Returns: list
a session list (as UUID hashes, objects, profile names/IDs or session names)

non_running_sessions(self, return_objects=True, return_profile_names=False, return_profile_ids=False, return_session_names=False)

source code 

Retrieve a list of sessions that are currently _NOT_ in running state. If none of the return_* options is specified a list of session UUID hashes will be returned.

Parameters:
  • return_objects (bool) - return as list of X2GoSession instances
  • return_profile_names (bool) - return as list of profile names
  • return_profile_ids (bool) - return as list of profile IDs
  • return_session_names (bool) - return as list of X2Go session names
Returns: list
a session list (as UUID hashes, objects, profile names/IDs or session names)

connected_sessions_of_profile_name(self, profile_name, return_objects=True, return_session_names=False)

source code 

For a given session profile name retrieve a list of sessions that are currently connected to the profile's X2Go server. If none of the return_* options is specified a list of session UUID hashes will be returned.

Parameters:
  • profile_name (str) - session profile name
  • return_objects (bool) - return as list of X2GoSession instances
  • return_session_names (bool) - return as list of X2Go session names
Returns: list
a session list (as UUID hashes, objects or session names)

associated_sessions_of_profile_name(self, profile_name, return_objects=True, return_session_names=False)

source code 

For a given session profile name retrieve a list of sessions that are currently associated by an X2GoTerminalSession* to this X2GoClient instance. If none of the return_* options is specified a list of session UUID hashes will be returned.

Parameters:
  • profile_name (str) - session profile name
  • return_objects (bool) - return as list of X2GoSession instances
  • return_session_names (bool) - return as list of X2Go session names
Returns: list
a session list (as UUID hashes, objects or session names)

pubapp_sessions_of_profile_name(self, profile_name, return_objects=True, return_session_names=False)

source code 

For a given session profile name retrieve a list of sessions that can be providers for published application list. If none of the return_* options is specified a list of session UUID hashes will be returned.

Parameters:
  • profile_name (str) - session profile name
  • return_objects (bool) - return as list of X2GoSession instances
  • return_session_names (bool) - return as list of X2Go session names
Returns: list
a session list (as UUID hashes, objects or session names)

registered_sessions_of_profile_name(self, profile_name, return_objects=True, return_session_names=False)

source code 

For a given session profile name retrieve a list of sessions that are currently registered with this X2GoClient instance. If none of the return_* options is specified a list of session UUID hashes will be returned.

Parameters:
  • profile_name (str) - session profile name
  • return_objects (bool) - return as list of X2GoSession instances
  • return_session_names (bool) - return as list of X2Go session names
Returns: list
a session list (as UUID hashes, objects or session names)

virgin_sessions_of_profile_name(self, profile_name, return_objects=True, return_session_names=False)

source code 

For a given session profile name retrieve a list of sessions that are registered with this X2GoClient instance but have not yet been started (i.e. sessions that are in virgin state). If none of the return_* options is specified a list of session UUID hashes will be returned.

Parameters:
  • profile_name (str) - session profile name
  • return_objects (bool) - return as list of X2GoSession instances
  • return_session_names (bool) - return as list of X2Go session names
Returns: list
a session list (as UUID hashes, objects or session names)

running_sessions_of_profile_name(self, profile_name, return_objects=True, return_session_names=False)

source code 

For a given session profile name retrieve a list of sessions that are currently running. If none of the return_* options is specified a list of session UUID hashes will be returned.

Parameters:
  • profile_name (str) - session profile name
  • return_objects (bool) - return as list of X2GoSession instances
  • return_session_names (bool) - return as list of X2Go session names
Returns: list
a session list (as UUID hashes, objects or session names)

suspended_sessions_of_profile_name(self, profile_name, return_objects=True, return_session_names=False)

source code 

For a given session profile name retrieve a list of sessions that are currently in suspended state. If none of the return_* options is specified a list of session UUID hashes will be returned.

Parameters:
  • profile_name (str) - session profile name
  • return_objects (bool) - return as list of X2GoSession instances
  • return_session_names (bool) - return as list of X2Go session names
Returns: list
a session list (as UUID hashes, objects or session names)

control_session_of_profile_name(self, profile_name)

source code 

For a given session profile name retrieve a the corresponding X2GoControlSession* instance.

Parameters:
  • profile_name (str) - session profile name
Returns: X2GoControlSession* instance
contol session instance

connected_profiles(self, use_paramiko=False, return_profile_ids=True, return_profile_names=False)

source code 

Retrieve a list of all currently connected session profiles.

Parameters:
  • use_paramiko (bool) - send query directly to the Paramiko/SSH layer
Returns: list
list of connected session profiles

get_master_session(self, profile_name, return_object=True, return_session_name=False)

source code 

Retrieve the master session of a specific profile.

Parameters:
  • profile_name (str) - the profile name that we query the master session of
  • return_object (bool) - return X2GoSession instance
  • return_session_name (bool) - return X2Go session name
Returns: list
a session list (as UUID hashes, objects, profile names/IDs or session names)

Property Details

has_running_sessions

Equals True if the underlying X2GoClient instance has any running sessions at hand.

Get Method:
unreachable.has_running_sessions(self) - Equals True if the underlying X2GoClient instance has any running sessions at hand.

has_suspended_sessions

Equals True if the underlying X2GoClient instance has any suspended sessions at hand.

Get Method:
unreachable.has_suspended_sessions(self) - Equals True if the underlying X2GoClient instance has any suspended sessions at hand.

connected_control_sessions

Equals a list of all currently connected control sessions.

Get Method:
unreachable.connected_control_sessions(self) - Equals a list of all currently connected control sessions.