Agent Service
Agent Service provides HTTP interface to interact with all agent machines uniquely located using agent prefix. APIs to spawn components takes agent prefix as parameter. Agent prefix is used to locate agent machine using Location Service.
Agent Service provides APIs to spawn Sequence Manager, Sequence Components and to kill spawned components.
Creation of Agent Service¶
Pre-requisite¶
In order to use agent service APIs¶
- Agent machines should be up and running.
- Locations of agent machines should be registered in Location Service.
- Authorization token with correct access role. Documentation on how to fetch authorization token could be found here.
To create Agent Service client¶
Note that the examples are using async/await which makes handling of promises more readable.
Usages of Agent Service¶
Type definitions for all Agent Service methods can be found here
Spawning a Sequence Manager¶
Agent Service requires agent (a component of type :Machine
) to be able to process requests. Once it locates an agent using Location Service with the help of agent prefix, it sends a spawn Sequence Manager command to the agent machine. The corresponding AP call fails if the Sequence Manager is already running, or the underlying agent fails to spawn it.
Type definitions for spawnSequenceManager
can be found here
Spawning a Sequence Component¶
Similar to spawning a Sequence Manager, Agent Service locates an agent and then it sends a spawn Sequence Component command to the agent machine. The corresponding API call fails if the Sequence Component is already running, or the underlying agent fails to spawn it.
Type definitions for spawnSequenceComponent
can be found here
Kill a Sequence Component¶
Agent service kills any process running on the agent machine using the process id (pid) of that component. it uses location service to find the process id from the metadata field of location information.
Type definitions for killComponent
can be found here