asphalt.py4j.component

class asphalt.py4j.component.Py4JComponent(gateways: typing.Dict[str, typing.Dict[str, typing.Any]] = None, **default_gateway_args)

Bases: asphalt.core.component.Component

Creates one or more JavaGateway resources.

If gateways is given, a Java gateway resource will be published for each key in the dictionary, using the key as the resource name. Any extra keyword arguments to the component constructor will be used as defaults for omitted configuration values. The context attribute will by default be the same as the resource name, unless explicitly set with the context_attr option.

If gateways is omitted, a single gateway resource (default / ctx.java) is published using any extra keyword arguments passed to the component.

Parameters:
classmethod configure_gateway(launch_jvm=True, gateway=None, callback_server=False, javaopts=(), classpath='')

Configure a Py4J gateway.

Parameters:
  • launch_jvm (bool) – True to spawn a Java Virtual Machine in a subprocess and connect to it, False to connect to an existing Py4J enabled JVM
  • gateway (Union[GatewayParameters, Dict[str, Any], None]) – either a GatewayParameters object or a dictionary of keyword arguments for it
  • callback_server (Union[CallbackServerParameters, Dict[str, Any]]) – callback server parameters or a boolean indicating if a callback server is wanted
  • javaopts (Iterable[str]) – options passed to Java itself
  • classpath (Iterable[str]) – path or iterable of paths to pass to the JVM launcher as the class path