Analytics Manager > Working with Flexible Scaling > Configure Agents to Support Deployment
Configure Agents to Support Deployment
If a particular analysis tool is running on a machine, and capacity is available on that machine, then if there is a “need capacity” event, you can use this capacity to perform computations. Using the existing capacity implies starting up a new instance of the software and in turn, deploying an instance of the agent. The new deployed agent can start a new client instance to take up the load of performing computations. Any agent can be configured to work as a deployer agent.
The following table provides information about the SDK agent type and the type of deployer agents they support:
SDK Agent Type
Can be configured to support
.NET SDK agent
Docker deployer
Java SDK agent
JAR deployer
Docker deployer
Any given agent can be configured to run in any of the following modes:
Perform computations only
Perform computations and also act as a deployer agent
Deployer agent only
For any agent to run as a deployer agent, set the following properties in the file of the agent:
Set to true to deploy new docker-based or jar-based analysis agents.
Specifies the name of the class that implements a custom deployer agent.
Specifies the connector on the ThingWorx server that is used by the custom deployer agent.
If you want an agent to work only as a deployer agent, and not perform computations, then comment out the ConnectorName property in the file of the agent.
Complete the following steps to start a deployer agent:
1. Create the analysis provider by using one of the following connectors:
2. Create an analysis model for the provider that you have created.
To create a model for the Jar deployer provider, use a Jar file as a model file.
To create a model for the docker deployer provider, enter a name in the Model Name (Required) field.
The analysis model that you create does not use the input model file for computations. Instead, inputs to the analysis model are commands that start up an agent instance.
Enable the model that you create.
You can test the model by providing appropriate inputs to verify that it deploys the deployer agent correctly. For more information about testing a model, see Test an Analysis Model.
3. If there is a “need capacity event”, the deployer agent can start a client instance for any provider. To enable the deployer agents to do this, create the provider to deployer mapping. Use the CreateProviderToDeployerMapping service in the TW.AnalysisServices.CapacityManagementServicesAPI resource. This service maps an analysis provider to the deployer provider and the deployer model. This allows the deployer agent that you start to start up a client instance for models that are created on the provider.
For every analysis provider, you can create only one mapping to the deployer provider.
4. Use the CreateDeploymentInfo service in the TW.AnalysisServices.CapacityManagementServicesAPI resource to provide deployment information for the provider by using the following information:
You might have to create an infotable of the following input values.
For the JAR deployer agent:
installDir — Specify the path where you want to install the agent. Ensure that the user who is running the agent has appropriate permissions to install the agent at the location that you selected.
For example, if you specify the value as D:\JAR-deployer, the agent is installed at this location.
mainClass — Provide a main class that your JAR file uses. This parameter is optional in the following cases:
If you are deploying the analysis agent
If your Jar file has a manifest that has the main class specified
isAnalysisAgentJar — Set this to true if the JAR file is defined by using the application interface.
reDeploy — Set this to true if you want to overwrite the existing agent, if present, at the specified install directory.
arguments — Specify the arguments as individual parameters that are used to start up the agent.
For example, if you have used the analysis_sdk_sample.jar as the model input file, then the java -cp analysis_sdk_sample.jar com.ptc.analysis.client.impl.AnalysisSDKAgent mode=null command must be specified under arguments as individual parameters. Enter java, -cp, analysis_sdk_sample.jar, com.ptc.analysis.client.impl.AnalysisSDKAgent, mode=null, and as separate rows.
additionalFiles — Provide information about any additional files that are required by the agent. This parameter is optional.
targetFile — Specify the path and name of the additional file in the install directory. This is the location where the file is copied relative to the install directory.
URL — Specify the URL of the input file. The input file can be uploaded in the same way that you upload models with file inputs. For more information, see the “Upload models with file inputs” section in Upload Different Types of Models.
addToClasspath — Set this to true to add this additional file to the class path.
You can provide multiple additional files. Specify each additional file as a single row.
properies — Specify properties that you want the agent to use.
name — Specify the name of the property.
value — Specify the value of the property.
targetFile — Specify the name of the properties file. Analytics Manager only supports files with the .properties format.
If you want, you can use the properties in the file in the .NET or Java SDK packages that are included with Analytics Manager.
You can provide multiple properties. Specify each property as a single row.
For the docker deployer agent:
image — Specify the URI that contains docker registry with a port and a path to the docker image name.
For example, myregistry.local:5000/testing/test-image:latest
Here, myregistry.local is the docker registry, 5000 is the port, testing/test-image is the docker image name, and latest is the tag.
command — Specify the operating system launch command or the application launch command that you want to launch inside the docker container.
For example, to launch Apache Tomcat server, use the following command:
options — Specify the flag or property of the docker container that is used to customize how the container starts up. The options correspond to the options of the docker run command.
For example, to set an environment variable for JAVA_HOME, specify the following option:
-e JAVA_HOME = /opt/jdk1.8.0_121
You can provide multiple options. Specify each option as a single row.
arguments — Specify the arguments that are required by the command.
For example, arguments for the command used to start Apache Tomcat are run, start, or stop.
You can provide multiple arguments. Specify each argument as a single row.
For more information about docker, see Docker Documentation.
5. Use the Deploy service in the TW.AnalysisServices.CapacityManagementServicesAPI resource to deploy the application to a specific provider. The agent deployment is run as an analysis job. The Analysis Jobs page provides information whether the job has been successfully completed or not. Depending on the deployer agent that you started, the following information is available:
For Jar deployer agent
The host on which the JAR deployer agent is deployed.
The installation directory where the agent is installed.
For docker deployer agent
The ID of the docker container that is started.
The deployer agent can be used to start up a client instance where capacity is needed.
Was this helpful?