clearml-docs/docs/clearml_agent/clearml_agent_services_mode.md
2024-07-15 15:53:41 +03:00

39 lines
1.8 KiB
Markdown

---
title: Services Mode
---
ClearML Agent supports a **Services Mode** where, as soon as a task is launched off of its queue, the agent moves on to the
next task without waiting for the previous one to complete. This mode is intended for running resource-sparse tasks that
are usually idling, such as periodic cleanup services or a [pipeline controller](../references/sdk/automation_controller_pipelinecontroller.md).
To run a `clearml-agent` in services mode, run:
```bash
clearml-agent daemon --services-mode --queue services --create-queue --docker <docker_name> --cpu-only
```
To limit the number of simultaneous tasks run in services mode, pass the maximum number immediately after the
`--services-mode` option (for example: `--services-mode 5`).
:::note Notes
* `services-mode` currently only supports Docker mode. Each service spins on its own Docker image.
* The default `clearml-server` configuration already runs a single `clearml-agent` in services mode that listens to the
`services` queue.
:::
Launch a service task like any other task, by enqueuing it to the appropriate queue.
:::warning
Do not enqueue training or inference tasks into the services queue. They will put an unnecessary load on the server.
:::
## Setting Server Credentials
Self-hosted [ClearML Server](../deploying_clearml/clearml_server.md) comes by default with a services queue.
By default, the server is open and does not require username and password, but it can be [password-protected](../deploying_clearml/clearml_server_security.md#user-access-security).
In case it is password-protected, the services agent will need to be configured with server credentials (associated with a user).
To do that, set these environment variables on the ClearML Server machine with the appropriate credentials:
```
CLEARML_API_ACCESS_KEY
CLEARML_API_SECRET_KEY
```