Analytics Manager > Working with Predictive Scoring > How ThingPredictor Works > Configure and Deploy the ThingPredictor Agent
Configure and Deploy the ThingPredictor Agent
The ThingPredictor analysis agent is available as a JAR file that includes all of the dependencies necessary to score data. You can use ThingPredictor only after you deploy it. Subsequently, the ThingPredictor agent must be restarted any time the server where it runs is restarted.
Prerequisites
To deploy the ThingPredictor agent, ensure that you have done the following:
Analytics Manager is installed and running.
Analytics Builder is installed and running.
Configure the ThingPredictor agent
1. Download the ThingPredictor package. Follow the procedure in the ThingWorx Analytics Extension Installation Guide.
2. From the ThingWorx-Analytics-ThingPredictor directory, open the predictive-standalone.yml file, and edit the following values in the analysis section of the file, and save the file:
Property
Description
ScanRate
This property is applicable to simulation jobs only.
Specifies the interval in milliseconds at which the agent checks for simulation property updates and triggers analysis jobs. Jobs are triggered only if property values have changed since the last scan time. By default, this is set to is 15000.
AppImplClass
Specifies the fully qualified name of the class that implements the application interface. This class contains the bridging code between the agent and the analysis provider. This class must be in the classpath provided to the JVM when running the agent.
This property is required. By default, this is set to com.thingworx.analysis.TWAnalysisAgentAdapter.
ConnectorName
The connector to which this agent must communicate. The default value TW.AnalysisServices.ThingPredictorConnector is installed by the Analytics Manager extension on the ThingWorx server.
AgentWorkDir
Optionally, the working directory can be changed to any accessible location. By default, a folder called AgentWorkDir is created inside the directory from where ThingPredictor is deployed and models are downloaded to the following path:
AgentWorkDir/TW.AnalysisServices.ThingPredictorConnector/Models/
AppExecutionThreadpoolSize
Specifies the number of threads to be kept in the thread pool for job execution. By default, this is set to 1.
ClientInstanceInitCount
Specifies the number of client instances that start when the agent is started. The default value is 1.
ClientInstanceMaxCount
Specifies the maximum number of client instances that this agent can start. The default value of 1 specifies that the agent can start only one client.
* 
Do not change this value.
GatherClientHealthData
Set the value to true to monitor the health of the client.
ClientHealthDataInterval
Specifies the time interval in milliseconds after which the agent SDK polls the system and its clients for health information. The default value is 60000.
AgentId
Specifies a unique string that is used for identification of an agent to the ThingWorx server. If the value is not specified, the value is default.
3. Open the system-environment-variable.properties file, edit the following values, and save the file:
* 
This step is required only if you are running ThingPredictor agent 8.1.
Property
Description
analysis-manager-uri
Set to the URL where the ThingWorx server is running.
ws://<ThingWorx-Server-URL>:<Port-Number>/Thingworx/WS
analysis-manager-appkey
If an application key is necessary for user authentication, complete the following tasks:
Uncomment the analysis-manager-appkey property by removing “#” from the front of the line where the property is listed.
Update the value of analysis-manager-appkey.
Comment out the analysis-manager-user and analysis-manager-password properties by adding “#” in front of each row (#analysis-manager-user and #analysis-manager-password).
analysis-manager-user
analysis-manager-password
If user ID and password are required for authentication, leave the analysis-manager-appkey property commented out, but update the analysis-manager-user and analysis-manager-password properties with the appropriate credentials.
predictive.http.port
9090
If port 9090 is already in use, you can use any other available port.
predictive.admin.port
9091
If port 9091 is already in use, you can use any other available port.
microservices.server
Set to localhost.
working.directory
Specifies the location where ThingPredictor stores the db and logs folders.
analysis-simulation-interval
Specifies the agent wait time between simulation jobs. If an existing simulation job is running, and a new job comes in before this specified interval, then the agent skips the execution of the job.
By default, this is set to -1.
Deploy the ThingPredictor agent
1. In Analytics Manager, create the PredictorProvider analysis provider.
For more information about creating analysis providers, see Create an Analysis Provider.
2. Open a Command-Line prompt and navigate to the path where the ThingWorx-Analytics-ThingPredictor folder is saved:
<my-path>/ThingWorx-Analytics-ThingPredictor
3. Run the following command to deploy the ThingPredictor JAR file from the command line:
java "-Dvariables.file=file:///<Full_Path_to_system-environment-variable.properties file>" -jar thingpredictor.jar server predictive-standalone.yml
Operating System
Location where the system-environment-variable.properties file is saved
Value of -Dvariables.file parameter
Windows
C:\Users\Downloads\ThingWorx-Analytics-ThingPredictor
-Dvariables.file=file:///C:/Users/Downloads/ThingWorx-Analytics-ThingPredictor/system-environment-variable.properties
Unix
/opt/ThingWorx-Analytics-ThingPredictor
-Dvariables.file=file:///opt/ThingWorx-Analytics-ThingPredictor/system-environment-variable.properties
* 
For ThingPredictor agent versions previous to 8.1, use the following command:
java -jar thingpredictor.jar server prediction-with-analysis.yml
4. To stop the ThingPredictor agent, press Ctrl+C.
Was this helpful?