Skip to content

Commit

Permalink
Add page on server CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
davidberenstein1957 committed Jul 24, 2024
1 parent 6080d30 commit fc837aa
Show file tree
Hide file tree
Showing 2 changed files with 202 additions and 0 deletions.
201 changes: 201 additions & 0 deletions argilla/docs/reference/argilla-server/cli.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
# Server CLI

This section list and describe the commands offered by the `argilla` CLI application. If you need more information about the available
commands in the CLI you can use the `--help` option:

```sh
argilla --help
```

If you need more information about a specific command you can use the `--help` option too:

```sh
argilla users create --help
```

## Login

The `argilla login` command is used to store the local credentials of a user, with the main purpose of reusing these credentials
to automatically authenticate in the Argilla server to run other commands or Python scripts that use Argilla.

```sh
argilla login --api-url http://localhost:6900
```

:::{note}
To validate that the provided URL and API Key are valid, the `login` command will try to connect to the Argilla server
using the provided credentials.
:::

:::{note}
By default, Argilla will use `~/.cache/argilla` directory to store the local credentials. If you want to change this
behaviour, you can set a valid directory using the `ARGILLA_CACHE_DIR` environment variable.
:::

## Logout

The `argilla logout` command removes the stored local credentials previously generated by calling the `argilla login` command.

```sh
argilla logout
```

:::{note}
The `logout` will try to connect to the Argilla server before removing the stored credentials. If, for some reason,
the Argilla server is not available but you still want to remove the stored credentials, the `--force` option can
be used.
:::

## Whoami

The `argilla whoami` command prints the information (username, workspaces, API Key, etc.) of the logged-in user.

```sh
argilla whoami
```

## Info

The `argilla info` command prints the versions of the Python client, Argilla server and ElasticSearch server used and that might
be useful for debugging purposes or reporting an issue.

```sh
argilla info
```

## Users

The `argilla users` group of commands offers basic operations for managing the users of the connected Argilla server.

### Create a user

The `argilla users create` command allows you to easily create a new user from the command line. The command will prompt for the
username and password of the new user, but the following options can be provided:

- `--username`: The username of the new user.
- `--password`: The password of the new user.
- `--first-name`: The first name of the new user. If not provided, the username will be used.
- `--last-name`: The last name of the new user.
- `--role`: The role of the new user. The default value is `annotator`.
- `--workspace`: The name of the workspace where the new user will be added. It can be provided multiple times to add the user
to multiple workspaces.

```sh
argilla users create --username joe --first-name Joe --last-name Doe --role admin --workspace workspace1 --workspace workspace2
```

### Delete a user

The `argilla users delete` command allows you to easily delete an existing user from the command line by providing the username of the
user to delete.

```sh
argilla users delete joe
```

### List users

The `argilla users list` command shows the list of the registered users in the Argilla server. Optionally, the `--workspace`
option can be provided to show only the users that belong to a specific workspace.

```sh
argilla users list
```

## Workspaces

The `argilla workspaces` group of commands offers basic operations for managing the workspaces of the connected Argilla server.
The commands of this group that perform an operation in a specific workspace require the `--name` option to be provided to
specify the workspace where the operation will be performed.

### Create a workspace

The `argilla workspaces create` command allows you to easily create a new workspace from the command line.

```sh
argilla workspaces create my-new-workspace
```

### Add user to workspace

The `argilla workspaces add-user` command allows you to add a user to a workspace by providing the username of the user and the name of the workspace.

```sh
argilla workspaces --name my-workspace add-user joe
```

### Delete use from workspace

The `argilla workspaces delete-user` command allows you to delete a user from a workspace by providing the username of the user and the name of the workspace.

```sh
argilla workspaces --name my-workspace delete-user joe
```

### List workspaces

The `argilla workspaces list` command shows the list of the workspaces in the Argilla server.

```sh
argilla workspaces list
```

## Datasets

The `argilla datasets` group of commands offers basic operations for managing the datasets stored in the connected Argilla server.
The commands of this group that perform an operation in a specific dataset require the `--name` option to be provided and optionally
the `--workspace` option to specify the workspace where the dataset is stored. If the `--workspace` option is not provided, then the
workspace stored in the local credentials will be used.

### Delete a dataset

The `argilla datasets delete` command allows you to remove a `FeedbackDataset` from the Argilla server by providing the name of the
dataset and optionally the workspace where the dataset is stored.

```sh
argilla datasets --name my-dataset --workspace my-workspace delete
```

### List datasets

The `argilla datasets list` shows the list of the datasets stored in the Argilla server. The following options can be provided:

- `--workspace`: The name of the workspace from which the datasets will be listed. If not provided, all the datasets from all the workspaces
will be listed.
- `--type`: The type of datasets to be listed. Two possible values: `feedback` and `other` (for `TextClassification`, `TokenClassification` and `Text2Text` datasets).

```sh
argilla datasets list
```

## Server

The `argilla server` group of commands contains commands for managing the Argilla server and its database.

### Start the server

The `argilla server start` command will start the Argilla server blocking the current terminal. The following options can be provided:

- `--host`: The host where the Argilla server will be bound. Default value is `0.0.0.0`.
- `--port`: The port where the Argilla server will be bound. Default value is `6900`.
- `--access-log/--no-access-log`: Enable/disable the server access log. Default value is `True`.

### Database

The `argilla server database` group of commands offers functionality for managing the Argilla server database:

- `argilla server database migrate`: applies the database migrations.
- `argilla server database revisions`: list the different revisions to which the database can be migrated.

### User management using the database connection

The `argilla server database users` group of commands offers functionality for managing the users of the Argilla server. To do so,
the `argilla server database users` commands use the database connection instead of the Argilla API, so these commands will have
to get executed from a machine that has access to the database. To set the URL of the database that will be used by the commands,
check [SQLite and PostgreSQL](/getting_started/installation/configurations/server_configuration.md#sqlite-and-postgresql) section.

- `argilla server database users create`: creates a new user in the Argilla server database.
- `argilla server database users create_default`: creates the default users in the Argilla server database.
- `argilla server database users migrate`: migrates the users from the old `YAML` file to the Argilla server database.
- `argilla server database users update`: updates a user in the Argilla server database.

1 change: 1 addition & 0 deletions argilla/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ nav:
- FastAPI Server:
- Server configuration: reference/argilla-server/configuration.md
- Database migrations: reference/argilla-server/migrations.md
- Server CLI: reference/argilla-server/cli.md
- Telemetry:
- Server Telemetry: reference/argilla-server/telemetry.md
- Community:
Expand Down

0 comments on commit fc837aa

Please sign in to comment.