Class PythonWrapper

java.lang.Object
edu.tufts.hrilab.python.PythonWrapper

public class PythonWrapper extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    PythonWrapper(String file, boolean spoke)
    If running python module as a TRADE spoke (i.e., spoke == true), this constructor uses the default 127.0.0.1@10002 hub address and port.
    PythonWrapper(String file, boolean spoke, String hubContainer)
    If running python module as a TRADE spoke (i.e., spoke == true), this constructor requires setting the TRADE hub address and port.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    start(String... pythonArgs)
    Starts the python process.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • PythonWrapper

      public PythonWrapper(String file)
    • PythonWrapper

      public PythonWrapper(String file, boolean spoke)
      If running python module as a TRADE spoke (i.e., spoke == true), this constructor uses the default 127.0.0.1@10002 hub address and port.
      Parameters:
      file - python module to start
      spoke - if true, connect to TRADE as a spoke (requires a TRADE hub to be running)
    • PythonWrapper

      public PythonWrapper(String file, boolean spoke, String hubContainer)
      If running python module as a TRADE spoke (i.e., spoke == true), this constructor requires setting the TRADE hub address and port.
      Parameters:
      file - python module to start
      spoke - if true, connect to TRADE as a spoke (requires a TRADE hub to be running)
      hubContainer - TRADE hub to connect to of the form ip_adress@port (e.g., 127.0.0.1@10002)
  • Method Details

    • start

      public void start(String... pythonArgs)
      Starts the python process. Some important side effects: - Passes in the "--classpath" arg to python. As a result, Python modules that use argparse will need to use parse_known_args - Starts a shutdown hook to end the python process when the JVM is shut down