Altair® Panopticon

 

Creating Data Extract from Python

The Python connector allows the retrieval of output data from a Python Pyro (Python Remote Objects) process.

For Python connectivity, Python must be first installed, together with the latest version of Pyro4. In addition, Pyro must be initiated manually or through using the batch file start_Python_connectivity.bat.

If the scripts utilize additional modules such as Numpy & Scipy in the shipped example, these also need to be installed into the existing Python installation.

Steps:

1.     On the New Data Extract page, select Python in the Connector drop-down list.

2.     Enter the following properties:

Property

Description

Host

Python Pyro instance host address.

Port

Python Pyro host port. Default is 9090.

HMAC Key

Set to password.

Data Object Name

The data structure (list of dictionaries) that Panopticon will produce, and then will be utilized by the Python Script.

 

3.     Select the Serialization Type: Serpent or Pickle.

·         Serpent – simple serialization library based on ast.literal_eval

·         Pickle – faster serialization but less secure

Modify the configuration.py  file located in ..\Anaconda3\Lib\site-packages\Pyro4 to specify the serialization to be used.

def reset(self, useenvironment=True): """ Set default config items. If useenvironment is False, won't read environment variables settings (useful if you can't trust your env). """ self.HOST = "localhost" # don't expose us to the outside world by default self.NS_HOST = self.HOST self.NS_PORT = 9090 # tcp self.NS_BCPORT = 9091 # udp self.NS_BCHOST = None self.NATHOST = None self.NATPORT = 0 self.COMPRESSION = False self.SERVERTYPE = "thread" self.COMMTIMEOUT = 0.0 self.POLLTIMEOUT = 2.0 # seconds self.SOCK_REUSE = True # so_reuseaddr on server sockets? self.SOCK_NODELAY = False # tcp_nodelay on socket? self.THREADING2 = False # use threading2 if available? self.ONEWAY_THREADED = True # oneway calls run in their own thread self.DETAILED_TRACEBACK = False self.THREADPOOL_SIZE = 16 self.AUTOPROXY = True self.MAX_MESSAGE_SIZE = 0 # 0 = unlimited self.BROADCAST_ADDRS = "<broadcast>, 0.0.0.0" # comma separated list of broadcast addresses self.FLAME_ENABLED = False self.PREFER_IP_VERSION = 4 # 4, 6 or 0 (let OS choose according to RFC 3484) self.SERIALIZER = "pickle" self.SERIALIZERS_ACCEPTED = "pickle,marshal,json" # these are the 'safe' serializers self.LOGWIRE = False # log wire-level messages self.PICKLE_PROTOCOL_VERSION = pickle.HIGHEST_PROTOCOL self.METADATA = True # get metadata from server on proxy connect self.REQUIRE_EXPOSE = False # require @expose to make members remotely accessible (if False, everything is accessible) self.USE_MSG_WAITALL = hasattr(socket, "MSG_WAITALL") and platform.system() != "Windows" # not reliable on windows even though it is defined self.JSON_MODULE = "json" self.MAX_RETRIES = 0

For example, if Pickle is selected, self.SERIALIZER value should be changed to pickle and self.SERIALIZERS_ACCEPTED  value should be changed to include pickle:

4.     Select whether the parameters should be automatically enclosed in quotes by checking the Enclose parameters in quotes box.

5.     Enter the required Python script to execute on the active Pyro instance.

6.     Click    to save and display the details of the data extract.

7.     Click   then   to display the data preview.