Task context.
Input parameters of the Task.
Task name.
Gets the tracking Data of the task.
Acquires a Run Lock.
A Run Lock is a way to lock resources and prevent conflicts when several task runs modify the same resource. The first task run to acquire the lock can access the resource, and other runs must wait until the resource is unlocked. You must define an arbitrary ID, which is the lock name.
This method returns a representation of a Run Lock.
Example of usage:
const myLock = await task.acquireLock('MyLockName');
if (myLock.success) {
// lock is acquired
// work on synchronized resource...
await myLock.release();
}
Optionally, you can set a retry timeout to acquireLock. In this case, it retries every 5 seconds to acquire the lock if the lock is already held by another run:
const myLock = await task.acquireLock('MyLockName', 15); // retry timeout of 15 seconds
if (myLock.success) { // lock was acquired before the timeout
// lock is acquired
// work on synchronized resource...
await myLock.release();
} else {
// after 3 attempts (1 attempt every 5 seconds) the lock is still held by another run.
}
Note: the retry timeout is rounded to fit with the retry frequency of 5 seconds. For example, if you set 12 seconds it retries up to 3 times.
If the lock is not explicitly released, it is automatically released when the Task run ends, whether the run succeeds or fails.
a run lock.
Adds tracking Data if not null or undefined.
Gets a Guardrail from the Task.
Gets a Skill from the Task.
Sending directly tracking Data if not null or undefined.