Package: autobahn-python-runners
The OpenDNA Autobahn-Python Runners package provides a number of scripts that
can be used to launch Autobahn-Python components and connect them to a WAMP
router.ContentsInstallationUsageCommand-line ParametersTwisted RunnerAsyncIO RunnerAsyncIO Multi-RunnerRoadmapInstallationpip installautobahn-python-runnersWhen the package is installed it will create the following scripts in your
Python environment’s scripts path:run_twisted_componentrun_asyncio_componentrun_asyncio_componentsOptionally, youpip install uvloopfor enhanced event-loop perforance with
the AsyncIO runners. You will needlibuvwith installed in order to do this.UsageUsage can be achieved through one of two methods:Execute one of the scripts created during installationExecute one of the modules using the standardpython-mmethodCommand-line ParametersThe following command-line parameters are supported by all of the runners
included in this package:Required parameters:-cor--componentis a fully-qualified path to an Autobahn-Python
component class E.g.some_org.some_package.some_module.SomeClass. Can be
alternatively specified using theWAMP_COMPONENTenviornment variable-uor--urlis a URL for the WAMP router to connect to
E.g.ws://localhost:8080. Can be alternatively specified using theWAMP_URLenvironment variable-ror--realmis a Realm on the WAMP router you are connecting to. E.g.my.realm.name. Can be alternatively specified using theWAMP_REALMenvironment variableOptional parameters:-eor--extra-fileis a path to a JSON file which will be loaded and
supplied to the component class instance via the config parameter of the
class constructor method-sor--use-sslis value that will be cast to a boolean and used to
specify whether or not SSL should be used for the WS connection. This
parameter is usually unnecessary as the decision to use SSL is usually
determined by the choice of WS protocol for the WAMP router URL. It is made
available here simply for the purposes of completeness-lor--loglevelis used to specify the logging level used by the runner.
Defaults toinfowith other permitted values beingcritical,error,warninganddebug--serializersis a fully qualified path to an Autobahn-Python serializer
class. This parameter may be specified multiple timesTwisted RunnerThe Twisted runner is provided by theopendna.autobahn.runners.run_twistedmodule and can be used to run components that derive from theautobahn.twisted.ApplicationSessionclass.AsyncIO RunnerThe AsyncIO runner is provided by theopendna.autobahn.runners.run_asynciomodule and can be used to run components that derive from theautobahn.asyncio.ApplicationSessionclass.AsyncIO Multi-RunnerThe AsyncIO multi-runner is provided by theopendna.autobahn.runners.multirun_asynciomodule and can be used to run multiple components that derive from theautobahn.asyncio.ApplicationSessionclass within a single Python process.These components will run within a single event-loop but each component will
establish a separate WS connection to the WAMP router.The AsyncIO multi-runner makes the following changes to the parameter options:-c/--componentmay be passed multiple times in order to specify
multiple component classes. Each class instance will connect to the same
WAMP router and realm specified using the relevant parameters-e/--extra-filecan still be used but behaves slightly differently in
that it expects that the JSON file will contain a plain object where each
key is a component class as specified using the-c/--componentparameter
and the value associated with each key is a plain object of data to be supplied
to the relevant component class instance via the config parameter of the
class constructor method-n/--necromancyis used to enable the transport recovery feature. When
enabled the multi-runner will periodically check to see if the WAMP connection
between a component and the router has failed. If a failure is detected then
a new component instance is created and will attempt to connect to the router--necromancy-sleepaccepts integers and defaults to10. This parameter
specifies how regularly the check for failed WAMP connections will be performedRoadmapDone:Twisted runnerAsyncIO runnerAsyncIO multi-runnerBasic documentationuvloop support for AsyncIO runnersOption for multi-runners to transparently restart crashed componentsTodo:TestsMaybe:Twisted multi-runner