Acquire lock
Take a named lock so no other agent run uses the same system at the same time. Optionally wait until the run holding it gives it back. The lock is given back by Release lock, or when this agent ends. With One CommandCenter the lock is shared by every runner; in OneAgentStudio on its own it works on this computer only.
Command in the Environment locks toolkit · id ooa.locks/acquire · 5 inputs (1 required), 2 outputs
Inputs
| Input | Type | Required | Default | What it is |
|---|---|---|---|---|
| Name | String | Yes | The lock's name, e.g. SAP production login. Names are compared without case. | |
| Wait (seconds) | Number | No | 0 | How long to wait for the lock when another run holds it; 0 tries once. |
| Lease (seconds) | Number | No | 3600 | How long the lock is held at most. After it, another run may take the lock. Acquire it again to renew the lease. |
| Comment | String | No | Why the lock is held, shown in One CommandCenter. | |
| Fail if not acquired | Boolean | No | false | Fail with LOCK.TIMEOUT when the lock is not acquired, instead of returning acquired false. |
Outputs
| Output | Type | What it is |
|---|---|---|
| acquired | Boolean | True when this run now holds the lock. |
| held_by | String | When not acquired: the run, runner and person holding it, and since when. |