eric7.Utilities.BackgroundService
Module implementing a background service for the various checkers and other
Python interpreter dependent functions.
Global Attributes
Classes
Functions
BackgroundService
    Class implementing the main part of the background service.
Signals
- batchJobDone(function, language)
- 
emitted to indicate the end of
        a batch job (str, str)
- serviceNotAvailable(function, language, filename, message)
- 
        emitted to indicate the non-availability of a service function
        (str, str, str, str)
Derived from
QTcpServer
Class Attributes
Class Methods
Methods
| BackgroundService | Constructor | 
| __getPythonInterpreter | Private method to generate the path of the Python interpreter to be used to run the background client. | 
| __processQueue | Private method to take the next service request and send it to the client. | 
| __receive | Private method to receive the response from the clients. | 
| __send | Private method to send a job request to one of the clients. | 
| __startExternalClient | Private method to start the background client as external process. | 
| enqueueRequest | Public method implementing a queued processing of incoming events. | 
| on_disconnectSocket | Private slot called when connection to a client is lost. | 
| on_newConnection | Private slot for new incoming connections from the clients. | 
| preferencesOrProjectChanged | Public slot to restart the built in languages. | 
| requestCancel | Public method to ask a batch job to terminate. | 
| restartService | Public method to restart a given language. | 
| serviceConnect | Public method to announce a new service to the background service/client. | 
| serviceDisconnect | Public method to remove the service from the service list. | 
| shutdown | Public method to cleanup the connections and processes when eric is shutting down. | 
Static Methods
BackgroundService (Constructor)
BackgroundService(parent=None)
        Constructor
- parent (QObject)
- 
reference to the parent object
BackgroundService.__getPythonInterpreter
__getPythonInterpreter()
        Private method to generate the path of the Python interpreter to be
        used to run the background client.
- Return:
- 
path of the Python interpreter
- Return Type:
- 
str
BackgroundService.__processQueue
__processQueue()
        Private method to take the next service request and send it to the
        client.
BackgroundService.__receive
__receive(lang)
        Private method to receive the response from the clients.
- lang (str)
- 
language of the incoming connection
- Raises RuntimeError:
- 
raised if hashes don't match
BackgroundService.__send
__send(fx, lang, fn, data)
        Private method to send a job request to one of the clients.
- fx (str)
- 
remote function name to execute
- lang (str)
- 
language to connect to
- fn (str)
- 
filename for identification
- data (any basic datatype)
- 
function argument(s)
BackgroundService.__startExternalClient
__startExternalClient(interpreter, port)
        Private method to start the background client as external process.
- interpreter (str)
- 
path and name of the executable to start
- port (int)
- 
socket port to which the interpreter should connect
- Return:
- 
the process object
- Return Type:
- 
QProcess or None
BackgroundService.enqueueRequest
enqueueRequest(fx, lang, fn, data)
        Public method implementing a queued processing of incoming events.
        Duplicate service requests update an older request to avoid overrun or
        starving of the services.
- fx (str)
- 
function name of the service
- lang (str)
- 
language to connect to
- fn (str)
- 
filename for identification
- data (any basic datatype)
- 
function argument(s)
BackgroundService.on_disconnectSocket
on_disconnectSocket(lang)
        Private slot called when connection to a client is lost.
- lang (str)
- 
client language which connection is lost
BackgroundService.on_newConnection
on_newConnection()
        Private slot for new incoming connections from the clients.
BackgroundService.preferencesOrProjectChanged
preferencesOrProjectChanged()
        Public slot to restart the built in languages.
BackgroundService.requestCancel
requestCancel(fx, lang)
        Public method to ask a batch job to terminate.
- fx (str)
- 
function name of the service
- lang (str)
- 
language to connect to
BackgroundService.restartService
restartService(language, forceKill=False)
        Public method to restart a given language.
- language (str)
- 
to restart
- forceKill (bool)
- 
flag to kill a running task
BackgroundService.serviceConnect
serviceConnect(fx, lang, modulepath, module, callback, onErrorCallback=None, onBatchDone=None, )
        Public method to announce a new service to the background
        service/client.
- fx (str)
- 
function name of the service
- lang (str)
- 
language of the new service
- modulepath (str)
- 
full path to the module
- module (str)
- 
name to import
- callback (function)
- 
function called on service response
- onErrorCallback (function)
- 
function called, if client isn't available
- onBatchDone (function)
- 
function called when a batch job is done
BackgroundService.serviceDisconnect
serviceDisconnect(fx, lang)
        Public method to remove the service from the service list.
- fx (function)
- 
function name of the service
- lang (str)
- 
language of the service
BackgroundService.shutdown
shutdown()
        Public method to cleanup the connections and processes when eric is
        shutting down.