Table of Contents |
---|
...
Introduction
Jira | ||||||||
---|---|---|---|---|---|---|---|---|
|
The Universal Agent comes with a REST web service that allows it to be controlled from the command line or an application. The service supports the following operations:
- sending commands and
- showing status information.
Commands can be sent to an Agent:
- by use of a REST URI that is called from an HTTP client.
- by use of the Agent start script that
- Via any client application that sends the command with an HTTP request (JSON).
- Via the start script of the Agent.
The start script- makes use of a Java class that implements the HTTP client.
- sending commands
- via any client application that sends the command with an HTTP request (JSON).
Usage
The first argument is the Agent URI, for example http://localhost:
50004445
The following arguments are web service names (each starting with a slash) or commands (JSON or YAML).
With no argument, the client checks whether the Agent is alive.
The command responses are written to stdout
. In case of an error, the error message is written to stdout
and detailed messages are written to stderr
.
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
agent-client.sh http://127.0.0.1:5000 '{$TYPE: Terminate, sigtermProcesses: true}' agent-client.sh http://127.0.0.1:5000 '{$TYPE: Terminate, sigtermProcesses: true}' /overview |
Status Information
Start Script Status Information
Jira | ||||||||
---|---|---|---|---|---|---|---|---|
|
...
The web service overview is called using, e.g. .
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
./jobscheduler_agent.sh status |
...
Web Service Status Information
Jira | ||||||||
---|---|---|---|---|---|---|---|---|
|
...
The Universal Agent provides status information via web services.
URI Syntax
All API URIs start with an optional prefix (if set on starting the Agent with the command line option -uri-prefix
) followed by the path, e.g. /jobscheduler/agent/api
.
...
http://host:port
/jobscheduler/agent/api/task/commandhttp://host:port
/jobscheduler/agent/api/tunnel/id
...
Examples
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
totalTaskCount: 0 isTerminating: false system: hostname: docker-agent mxBeans: operatingSystem: processCpuLoad: 9.71859949958501E-7 availableProcessors: 8 freePhysicalMemorySize: 1791545344 systemCpuLoad: 0.00774040220626055 committedVirtualMemorySize: 4809150464 totalPhysicalMemorySize: 4897579008 currentTaskCount: 0 java: systemProperties: java.vendor: Azul Systems, Inc. os.arch: amd64 os.version: 3.10.0-229.7.2.el7.x86_64 os.name: Linux java.version: 1.8.0_25 version: 1.10.0-xx startedAt: '2015-08-19T15:21:42.423Z' |
...
- abort immediately:
- the Agent will kill all running tasks and will terminate immediately
- the client sends:
{ "$TYPE": "AbortImmediately" }
- this corresponds to the XML command that is used for a Master:
<modify_spooler cmd='abort_immediately'/>
- terminate:
- the Agent will not start new tasks, existing tasks can continue and the Agent will terminate after all tasks have completed
- optionally a SIGTERM can be sent to the tasks
- the client sends:
{ "$TYPE": "Terminate", "sigtermProcesses": false }
- this corresponds to the XML command that is used for a Master:
<modify_spooler
cmd='terminate'
/>
- terminate with timeout:
- the Agent sends all tasks a SIGTERM command and will wait for the specified timeout.
Should any task not terminate within the specified timeout then it will be killed with a SIGKILL signal. - the client sends:
{ "$TYPE": "Terminate", "sigtermProcesses": false, "sigkillProcessesAfter": 15 }
- this corresponds to the XML command that is used for a Master:
<modify_spooler
cmd='terminate'
timeout='15'
/>
- the Agent sends all tasks a SIGTERM command and will wait for the specified timeout.
Examples
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
agent-client.sh http://127.0.0.1:5000 '{$TYPE: Terminate, sigtermProcesses: true} agent-client.sh http://127.0.0.1:5000 '{$TYPE: Terminate, sigtermProcesses: true} /overview |
...