emsm.core.application¶
-
exception
emsm.core.application.ApplicationException[source]¶ Bases:
ExceptionBase class for all exceptions in this module.
-
exception
emsm.core.application.WrongUserError(required_user)[source]¶ Bases:
emsm.core.application.ApplicationExceptionRaised if the EMSM is executed by the wrong user.
-
class
emsm.core.application.Application(instance_dir)[source]¶ Bases:
objectThis 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
Configurationinstance.
-
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
Pathsysteminstance.
-
plugins()[source]¶ Returns the used
PluginManagerinstance.
-
server()[source]¶ Returns the used
ServerManagerinstance.
-
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: - TypeError – if code is not an int.
- ValueError – if code < 0.
See also
exit_code()exit()
-
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
WorldManagerinstance.
-