# CLI References

## Authentication <a href="#authentication" id="authentication"></a>

### Login

Authenticate user to CLI via provided token.

```sh
float16 login --token <YOUR_TOKEN>
```

#### Options

* `--token <YOUR_TOKEN>` (required): Your authentication token.
  * If `--token` is provided, attempts to authenticate with the given token.
  * If `--token` is omitted, prompts the user to input the token.

{% hint style="warning" %}
All commands, except for `float16 init` , `float16 example list` ,`float16 example` ,require the user to be logged in before use.
{% endhint %}

### Token

Display the current token and configuration file path.

```sh
float16 token
```

### Logout

Log out the current user.

```bash
float16 logout
```

This command ends the current authenticated session.

## Project Management <a href="#project-management" id="project-management"></a>

### Init

Initializes a new project in the current directory. Creates `float16.conf` and `requirements.txt` files.

```bash
float16 init
```

### Example

creates a specific project from our predefined examples.

```bash
float16 example <EXAMPLE>
```

### Example list

displays a list of all available example projects.

```bash
float16 example list
```

{% hint style="info" %}
You can also view the list of example projects in our repository.
{% endhint %}

### Create

Creates a new project with a specific instance type to enable your project's computational environment.

**Requires**

* Instance type must be valid
* Project must not exist or must be deleted
* If `--instance` is omitted, interactive input for instance type will be prompted

```
float16 project create --instance <INSTANCE_TYPE> --name <PROJECT_NAME>
```

**Options**

* `--instance <INSTANCE_TYPE>` : (Required) Specifies instance type for container
* `--name <PROJECT_NAME>`  or  `-n <PROJECT_NAME>`: (Optional) Specifies name for project

### Start

Begins a new project session and automatically installs packages listed in requirements.txt (if present).&#x20;

#### Requires

* `float16.conf` file would exist.

```bash
float16 project start
```

### Install

Installs packages specified in the project's requirements.txt file.&#x20;

#### Requires

* `requirements.txt` file would exist.
* Project must be started before running this command.

<pre class="language-bash"><code class="lang-bash"><strong>float16 project install
</strong></code></pre>

### Delete <a href="#task-management" id="task-management"></a>

Removes project container, permanently deleting the project and associated resources.

**Requires**

* Instance type must be valid
* Project must not exist or be deletable
* If `--project-id` is omitted, reads project ID from `float16.conf`

```
float16 project delete
```

**Options**

* `--project-id` : Project ID to delete
  * Optional if project ID exists in float16.conf (will delete current active project)
  * Required if no project ID is found in float16.conf

### List

Displays list of all projects under the workspace, including deleted projects.

**Options**

* `-n, --limit <number>`: (Optional) Specifies the number of tasks to display.
* `-a, --all`: (Optional) Displays all tasks, overriding the default limit.

```
float16 project list
```

#### Output

```bash
Project ID | Instance Type | Status  | Created At          | Last Updated
aaaaaaaa   | aws           | Active  | 2023-09-24 10:00:00 | 2023-10-24 10:00:00
bbbbbbbb   | aws           | Deleted | 2023-09-24 11:30:00 | 2023-10-24 11:30:00
```

{% hint style="info" %}
Display 20 queued tasks if no option is specified
{% endhint %}

## Task Management <a href="#task-management" id="task-management"></a>

### Run

Executes a Python script on a remote instance.

#### Requires

* `<file>` must exist and be a .py file.
* `<name>` (if provided) must be alphanumeric and less than 64 characters.
* Project must be started before running this command.

```bash
float16 run <YOUR_FILE> --name <NAME>
```

#### Parameters

* `<YOUR_FILE>`: Path to the Python script to run.

#### Options

* `--name <NAME>`(Optional): Custom name for the task.
* `--spot` (Optional): Activate Spot mode.
* `--budget <budget_limit>`(Optional): \[Spot Mode] Config limit budget of spot task. (default 10 USD)

### Task

Retrieves details of a specific task.

```bash
float16 task <TASK_ID>
```

#### Parameters

* `<TASK_ID>` : task id must be exist&#x20;

#### Output

```bash
Task ID: TASK-XXXXX
Name: [task name]
Type: [Develop or Deploy]
Status: [status]
Created At: [timestamp]
Completed At: [timestamp or N/A]
Duration: [duration or N/A]
Project ID: [project id]
```

### Task list

Displays a list of all tasks.

#### Options

* `-n, --limit <number>`: Specify the number of queued tasks to display
* `-a, --all`: Display all queued tasks
* `--type` : Specify the type of tasks to display (e.g., manual, server, function).
* `--project-id` : Specify the project of tasks to display

```bash
float16 task list
```

#### Output

```bash
Task ID   | Name     | Type     | Status   | Created At          | Project ID
TASK-0001 | Task 1   | Develop  | Running  | 2023-09-24 10:00:00 | aaaaaaa
TASK-0002 | Task 2   | Deploy   | Completed| 2023-09-24 11:30:00 | aaaaa....bbbb
```

{% hint style="info" %}
Display 20 queued tasks if no option is specified
{% endhint %}

### Task log

Prints the log of a specific task.

#### Parameters

* `<TASK_ID>` : Existing task ID

```bash
float16 task log <TASK_ID>
```

#### Output

```
✅ Task log fetched successfully
Task Log:
====================
<YOUR_TASK_LOG>
====================
```

### Task stop

stop spot task

#### Parameters

* `<TASK_ID>` : Existing task ID

```bash
float16 task spot stop <TASK_ID>
```

### Task adjust

adjust spot task configuration

#### Parameters

* `<TASK_ID>` : Existing task ID

```bash
float16 task spot adjust <TASK_ID> --budget <budget_limit>
```

#### Options

* `--budget <budget_limit>`: Specify budget limit

## Queue Management <a href="#queue-management" id="queue-management"></a>

### Queue list

Displays a list of all queued tasks.

```bash
float16 queue list
```

#### Output

<pre class="language-bash"><code class="lang-bash">✅ Queued tasks fetched successfully
Queue ID  | Task ID | Created At | Position
<strong>0 | TASK-0003 | 2023-09-24 12:00:00 | QUEUE-001
</strong>1 | TASK-0004 | 2023-09-24 12:15:00 | QUEUE-002
</code></pre>

### Delete queue

Removes a specific task from the queue.

#### Parameters

* `<TASK_ID>` : Valid queue ID of the task to be removed

```bash
float16 queue delete <TASK_ID>
```

## Deployment <a href="#storage-management" id="storage-management"></a>

### Deploy

Deploys the specified application to the remote instance.

**Requires**

* Application must exist and be a .py file
* Project ID must exist

<pre><code><strong>float16 deploy &#x3C;YOUR_APP>
</strong></code></pre>

#### Parameters

* `<YOUR_APP>`: Path to the Python script to deploy.

#### Options

* `--project-id <project_id>`: Project ID for deployment
  * Optional if project ID exists in float16.conf
  * Required if no project ID is found in float16.conf

#### Output

```bash
Application deployed successfully
Endpoint: <Endpoint Func>
          <Endpoint Server>
API Key:  <Endpoint API Key>
```

### Endpoint

Lists all available endpoints for the current or specified project.

**Requires**

* Project ID must exist
* If `--project-id` is omitted, reads project ID from `float16.conf`

```
float16 endpoint
```

**Options**

* `--project-id` : Project ID to list endpoints
  * Optional if project ID exists in float16.conf (will list endpoints of current active project)
  * Required if no project ID is found in float16.conf

#### Output

```bash
Function Endpoint: <Endpoint Func>
Server Endpoint: <Endpoint Server>
API Key: <Endpoint API Key>
Project ID: <project-id>
Status: <Endpoint Status>
Last Deployed: YYYY-MM-DD HH:MM:SS
```

### Stop Endpoint

Stops the active endpoint for the current or specified project.

**Requires**

* Project ID must exist
* Endpoint status must be active
* If `--project-id` is omitted, reads project ID from `float16.conf`

```
float16 endpoint stop
```

**Options**

* `--project-id` : Project ID to stop endpoint
  * Optional if project ID exists in float16.conf (will stop current active project endpoint)
  * Required if no project ID is found in float16.conf

### Start Endpoint

Starts the inactive endpoint for the current or specified project.

**Requires**

* Project ID must exist.
* Endpoint status must inactive.
* If `--project-id` is omitted, read project ID from `float16.conf` instead.

```
float16 endpoint start
```

**Options**

* `--project-id` : Project ID must exist
  * Endpoint status must be inactive
  * If `--project-id` is omitted, reads project ID from `float16.conf`

### Re-generate API Key

Generates a new API key for the current or specified project.

**Requires**

* Project ID must exist
* If `--project-id` is omitted, reads project ID from `float16.conf`

```
float16 endpoint regenerate
```

**Options**

* `--project-id` : Project ID to re-generate API key
  * Optional if project ID exists in float16.conf (will re-generate current active project API key)
  * Required if no project ID is found in float16.conf

## Storage Management <a href="#storage-management" id="storage-management"></a>

### Storage list

Displays a list of files in the project.

#### Requires

* Project must be started before running this command.

```bash
float16 storage ls
```

#### Output

```bash
Filename       | Size    | Type | Last Modified
example.py     | 1.2 KB  | File | 2023-09-24 14:00:00
data/          | 4.0 MB  | Dir  | 2023-09-24 13:30:00
```

{% hint style="info" %}
The system can display up to 1,000 files.
{% endhint %}

### Copy output

Copies output files to the user's S3 bucket.

#### Requires

* Project must be started before running this command.
* All parameters must be valid.

{% code overflow="wrap" %}

```bash
float16 storage copy-output --path <PATH> --s3-uri <S3-URI> --s3-access-key <S3-ACCESS-KEY> --s3-secret-key <S3-SECRET-KEY> --aws-region <AWS-REGION>
```

{% endcode %}

#### Options

* `--path <PATH>` (required): Path to the file or directory to be copied
* `--s3-uri <S3-URI>` (required): S3 URI where the copied file or directory will be placed
* `--s3-access-key <S3-ACCESS-KEY>` (required): S3 access key for authentication
* `--s3-secret-key <S3-SECRET-KEY>` (required): S3 secret key for authentication
* `--aws-region <AWS-REGION>` (required): AWS region for the S3 bucket

### Copy file to remote instance

Copies files from user's S3 to the remote instance.

#### Requires

* Project must be started before running this command.
* All parameters must be valid.

{% code overflow="wrap" %}

```bash
float16 storage copy-to-remote --path <PATH> --s3-uri <S3-URI> --s3-access-key <S3-ACCESS-KEY> --s3-secret-key <S3-SECRET-KEY> --aws-region <AWS-REGION>
```

{% endcode %}

#### Options

* `--path <PATH>` (required): Path to the destination where the copied file or directory will be placed
* `--s3-uri <S3-URI>` (required): S3 URI where the files will be copied to
* `--s3-access-key <S3-ACCESS-KEY>` (required): S3 access key for authentication
* `--s3-secret-key <S3-SECRET-KEY>` (required): S3 secret key for authentication
* `--aws-region <AWS-REGION>` (required): AWS region for the S3 bucket

### Remove file on remote instance

Removes a file from the remote instance.

#### Requires

* Project must be started before running this command.
* `<FILE>` must be valid.

```bash
float16 storage remove-on-remote --destination <PATH>
```

#### Options

* `-f, --files <FILE>` (required): Path to the file or directory to be removed
* `-p, --project-id <PROJECT_ID>` (optional): Project ID of the file or directory to be removed

### Upload file to remote instance

Upload file or directory from local storage to remote instance.

#### Requires

* Project must be started before running this command.
* `<FILE>` must be valid.

```bash
float16 storage upload --files <FILE>
```

#### Options

* `-f, --files <FILE>` (Required): Path to the file or directory to be uploaded
* `-d, --destination <PATH>` (optional): Path to the file or directory to be placed
* `-p, --project-id <PROJECT_ID>` (optional): Project ID of the file or directory to be placed

### Download file to local storage

download file to local storage.

#### Requires

* Project must be started before running this command.
* `<FILE>` must be valid.

```bash
float16 storage download --files <FILE>
```

#### Options

* `-f, --files <FILE>` (Required): Path to the file or directory to be downloaded
* `-d, --destination <PATH>` (optional): Path to the file or directory to be placed
* `-p, --project-id <PROJECT_ID>` (optional): Project ID of the file or directory to be downloaded

### Copy file

Copy a file or folder from remote storage to a specified destination. This includes copying within the same project or across different projects.

#### Requires

* Project must be started before running this command.
* `<FILE>` must be valid.

#### Parameters

* `<ORIGIN_PROJECT_ID>`: Project ID of the source file or folder
* `<FILE_PATH>`: Path to the file or folder you want to copy
* `<DESTINATION_PROJECT_ID>`: Project ID of the destination
* `<DESTINATION_PATH>`: Destination path for the copied file or folder

{% code overflow="wrap" %}

```bash
float16 storage copy <ORIGIN_PROJECT_ID>:<FILE_PATH> <DESTINATION_PROJECT_ID>:<DESTINATION_PATH>
```

{% endcode %}

{% hint style="info" %}

* You can also use the `float16 storage cp` command as a shorthand.
* If a file or folder with the same name already exists at the destination, it will be replaced.
* If you're copying a file from the current project (as defined in `float16.conf`), you do **not** need to specify `<ORIGIN_PROJECT_ID>`. \
  **Example:** `float16 storage copy <FILE_PATH> <DESTINATION_PROJECT_ID>:<DESTINATION_PATH>`
* If the destination path is the root of the destination project, you may omit `<DESTINATION_PATH>`. \
  **Example:** f`loat16 storage copy <ORIGIN_PROJECT_ID>:<FILE_PATH> <DESTINATION_PROJECT_ID>:`
  {% endhint %}

## General <a href="#general" id="general"></a>

### Help

Displays general help information or help for a specific command.

For general help:

```bash
float16 --help
```

For command-specific help:

```bash
float16 <command> --help
```

#### Example

```bash
float16 run --help
```

This will display help information for the 'run' command

### Get version

Displays the current version of the Float16 CLI.

```bash
float16 -v
```

or

```bash
float16 --version
```
