Jump to: navigation, search

Python Scripts

This section explains how to deploy and run the Python script.

How to deploy the script?

To deploy the script, follow these steps:

  1. On the master Feature Server instance, copy the <jython-version>.jar file from <FS installation path>\work\jetty-x.x.x.x-pppp-fs.war-_fs-any-\webapp\WEB-INF\lib to <FS installation path>\python\.
    The value of <jython-version>.jar varies depending on the Feature Server version:
    • 8.1.202.09 and earlier - jython-2.7b1.jar
    • 8.1.202.10 and later - jython-standalone-2.7.1b2.jar
    • 8.1.202.17 and later - jython-standalone-2.7.1b3.jar
    • 8.1.202.45 and later - jython-standalone-2.7.2.jar
  2. Open console and navigate to <FS installation path>\python\util, which contains the scripts.
  3. Copy both the above-mentioned python scripts to the path <FS installation path>\python\.
  4. Enter the command to set JYTHONPATH:
    Windows
    set JYTHONPATH=<FS installation path>\python
    Linux
    export JYTHONPATH=<FS installation path>/python

How to run the script?

Use the following command line format to run the script:

java -jar <jython-version>.jar <scriptname>.py <script input parameters>

The value of <jython-version>.jar varies depending on the Feature Server version.

Feature Server version Jython file
8.1.202.09 and earlier jython-2.7b1.jar
8.1.202.10 and later jython-standalone-2.7.1b2.jar
8.1.202.17 and later jython-standalone-2.7.1b3.jar
8.1.202.45 and later jython-standalone-2.7.2.jar
Important
Remove the Jython JAR file from the <FS installation path>\python\ directory after the execution of the script.

SSL and Cassandra authentication support for Feature Server Python scripts

Feature Server release 8.1.202.17 includes SSL and Cassandra authentication support for Feature Server Python scripts that are available in the <Feature Server deployment path>\python\util folder. The functionality of the Python scripts is not changed; only the support of SSL connection and authentication is added to the existing scripts.

The following errors will be seen for the respective failures:

  • TTransport error if SSL handshake fails.
  • Authentication error for wrong username and password. Python needs pycassa client to connect with Cassandra, this pycassa client will take effect of username password only if Authentication is enabled in Cassandra. Example: Passing wrong username/password for embedded Cassandra will not throw any error but the parameters will be ignored. If the default Username and password is not changed then also we will be able to connect with external Cassandra since the scripts will pass default value while making the connection.

How to run the Python scripts when SSL and Cassandra authentication is enabled?

Each script has its own set of input parameters.

  • When a different name is used for Cassandra keyspace other than sipfs, append the following input parameter:
    --keyspace — Cassandra keyspace name. The default value is sipfs
  • When Cassandra authentication is enabled, append the following parameters:
    -u <username> — Cassandra username. The default value is cassandra.
    --pw <password> —Cassandra password. The default value is cassandra.
  • When SSLis enabled, append the following parameter:
    --tls <tls_version>—Enables SSL connection. The default value is TLSv1.2.
Important
The copykeyspaceschema.py, copykesypacecolumnfamiles.py and removeSwitchDescription.py scripts require a JSON file as input. Therefore, for these three scripts the command arguments are not changed but the input file will contain the additional arguments.
This page was last edited on September 22, 2022, at 19:33.
Comments or questions about this documentation? Contact us for support!