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
  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
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 SSL and Cassandra authentication is enabled, append the following three additional input parameters:

  • -u <username>—The Cassandra username. Default value is "cassandra".
  • --pw <password>—The Cassandra password. Default value is "cassandra".
  • --tls—Enables SSL connection.
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 modified on January 23, 2019, at 02:16.

Feedback

Comment on this article:

blog comments powered by Disqus