emsm.core.application

exception emsm.core.application.ApplicationException[source]

Bases: Exception

Base class for all exceptions in this module.

exception emsm.core.application.WrongUserError(required_user)[source]

Bases: emsm.core.application.ApplicationException

Raised if the EMSM is executed by the wrong user.

class emsm.core.application.Application(instance_dir)[source]

Bases: object

This class manages the initialisation and the complete run process of the EMSM.

An EMSM application should be executed in a code structure similar to this one:

app = Application()
try:
    app.setup()
    app.run()
except Exception as err:
    app.handle_exception()
    raise
finally:
    exit(app.finish())
argparser()[source]

Returns the EMSM ArgumentParser, that is used internally.

conf()[source]

Returns the used Configuration instance.

exit_code()[source]

Returns the exit code of the application.

See also

set_exit_code()

finish()[source]

Performs some clean up and background stuff.

Returns:exit_code()

Note

Do not mix this method up with the emsm.core.plugins.PluginManager.finish() method. These are not related.

See also

handle_exception()[source]

Checks sys.exc_info() if there is currently an uncaught exception and logs it.

paths()[source]

Returns the used Pathsystem instance.

plugins()[source]

Returns the used PluginManager instance.

run()[source]

Runs the plugins.

server()[source]

Returns the used ServerManager instance.

set_exit_code(code)[source]

Sets the exit code to code. This is the exit code, that is used for the Python exit() function.

Raises:

See also

setup()[source]

Initialises all components of the EMSM.

This method will block, until the EMSM filelock could be acquired or the configuration timeout value is reached.

worlds()[source]

Returns the used WorldManager instance.