Metadata-Version: 2.4
Name: rpa-bot-sdk-performer
Version: 1.4.0
Summary: Orchestrator bot-side Performer role: REFramework-style state machine, QueueManager, TransactionItem, ExcelReporter.
Author: Kasun Perera
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: rpa-bot-sdk-core<2.0.0,>=1.5.0
Requires-Dist: openpyxl

# rpa-bot-sdk-performer

The Performer role's orchestration layer: `QueueManager`, `TransactionItem`,
the `FrameworkState` state machine (`InitState` -> `GetTransactionState` ->
`ProcessState` -> `EndTransactionState` -> `EndProcessState`), and
`ExcelReporter`.

Depends on [`rpa-bot-sdk-core`](../core/README.md) for the server client and
pause/stop controller — installing this package pulls that one in
automatically. A Dispatcher project never needs this package at all; install
[`rpa-bot-sdk-dispatcher`](../dispatcher/README.md) instead.

## In a Performer project's `requirements.txt`

```
rpa-bot-sdk-core==1.5.0
rpa-bot-sdk-performer==1.4.0
```

## A Secure Cloud Performer

Build the client yourself and hand it over, so the items it fetches are
decrypted and every write it makes (a retry, a requeue, `update_item_data`)
is encrypted again before it leaves the machine:

```python
from rpa_bot_sdk_core import SecureDbClient
from rpa_bot_sdk_performer import QueueManager

client = SecureDbClient(base_url=url, api_key=key,
                        phi_key_path="data/phi.key", secure_fields="*")
queue = QueueManager("", config, sub_process_name="Performer", client=client)
```

`queue.client` is the registered client. Reuse it for any other server call
of the run, so the call carries this run's token.

## Holding an item back: `queue.requeue()` (1.4.0)

```python
later = (datetime.now(timezone.utc) + timedelta(minutes=30)).isoformat()
queue.requeue(item, postpone_until=later)
```

The item this run holds goes back to New and is not dispatched before
`postpone_until`. It is the same queue row: its Unique ID, data and retry
count are kept, and the wait is not counted as a failed attempt -- use it
while a person answers an action the item waits on (docs/HUMAN_ACTIONS.md).
A refusal raises `RuntimeError`.

The row's data is not sent. To keep something for the next pass, such as
the `action_id` the item waits on, store it first:

```python
item.data["_json_data"]["action_id"] = action_id
queue.update_item_data(item)
queue.requeue(item, postpone_until=later)
```

Before 1.4.0 it added the item again under the same Unique ID, which the
Orchestrator refuses as a duplicate, so the item was lost. It needs
Orchestrator v20.15.0, which answers `postpone_transaction`.

Pin both exactly. `rpa-bot-sdk-performer`'s own dependency on core is a
range (`>=1.0.0,<2.0.0`), which is fine for the *library* — a bot project's
own `requirements.txt` is what needs to be exact, so every machine installs
the same bytes.
