# 创建任务

Swan Client支持使用 `car.json` 或 `car.csv` 创建三种不同的任务。

## **私有任务**

Swan Client可以通过创建私有任务将订单直接发送给矿工。

```shell
swan-client task --input-dir [json_or_csv_absolute_path] --out-dir [output_files_dir] --miners [storage_provider_id1,storage_provider_id2,...]

OPTIONS:
   --name value                          任务名称
   --input-dir value, -i value           json 或 csv 格式源文件的绝对路径
   --out-dir value, -o value             目标文件将在的目录 (默认: "/tmp/tasks")
   --auto-bid                            发送自动竞价任务 (默认: false)
   --manual-bid                          发送手动竞价任务 (默认: false)
   --miners value                        发送私有任务时'miners'是必填项 (以逗号分隔每个矿工ID)
   --dataset value                       数据集名称
   --description value, -d value         任务描述
   --max-copy-number value, --max value  发送自动竞价任务或手动竞价任务时每个文件的最大备份数量 (默认: 1)
```

**此步骤后生成的文件：**

* `[task-name]-metadata.json`: 包含 `Uuid` 和 `Deals`，供存储提供商导入订单。

## 自动竞价任务

Swan Client可以创建自动竞价任务，通过 Swan Platform 的市场匹配器（Market-Matcher）来自动匹配合适的存储提供商。

```shell
swan-client task --input-dir [json_or_csv_absolute_path] --out-dir [output_files_dir] --auto-bid true --max-copy-number 5


OPTIONS:
   --name value                          任务名称
   --input-dir value, -i value           json 或 csv 格式源文件的绝对路径
   --out-dir value, -o value             目标文件将在的目录 (默认: "/tmp/tasks")
   --auto-bid                            发送自动竞价任务 (默认: false)
   --manual-bid                          发送手动竞价任务 (默认: false)
   --miners value                        发送私有任务时'miners'是必填项 (以逗号分隔每个矿工ID)
   --dataset value                       数据集名称
   --description value, -d value         任务描述
   --max-copy-number value, --max value  发送自动竞价任务或手动竞价任务时每个文件的最大备份数量 (默认: 1)

```

**此步骤后生成的文件：**

* `[task-name]-metadata.json`: 包含 `Uuid` 和 `Deals`，供存储提供商导入订单。

## 手动竞价任务

用户可以在 Swan Platform 上创建手动竞价任务，每个存储提供商都可以从 Swan Platform 申请接单，然后用户将订单发送给申请的存储供应商。

### **(1) 创建手动竞价任务:**

```shell
swan-client task --input-dir [json_or_csv_absolute_path] --out-dir [output_files_dir] --manual-bid true --max-copy-number 5


OPTIONS:
   --name value                          任务名称
   --input-dir value, -i value           json 或 csv 格式源文件的绝对路径
   --out-dir value, -o value             目标文件将在的目录 (默认: "/tmp/tasks")
   --auto-bid                            发送自动竞价任务 (默认: false)
   --manual-bid                          发送手动竞价任务 (默认: false)
   --miners value                        发送私有任务时'miners'是必填项 (以逗号分隔每个矿工ID)
   --dataset value                       数据集名称
   --description value, -d value         任务描述
   --max-copy-number value, --max value  发送自动竞价任务或手动竞价任务时每个文件的最大备份数量 (默认: 1)
```

**此步骤后生成的文件：**

* `[task-name]-metadata.json`: 包含 `Uuid`, 源文件信息, 以及 CAR 文件信息。

### **(2) 发送订单给存储提供商：**

```shell
swan-client deal --json [path]/[task-name]-metadata.json -out-dir [output_files_dir] -miners [storage_provider_id1,storage_provider_id2,... ]

OPTIONS:
   --csv value                交易元数据的 CSV 文件路径 
   --json value               交易元数据的 JSON 文件路径 
   --out-dir value, -o value  目标文件将在的目录 (默认: "/tmp/tasks")
   --miners value             发送私有任务时'miners'是必填项 (以逗号分隔每个矿工ID)

```

**此步骤后生成的文件：**

* `[task-name]-deals.json`: 基于前述步骤生成的 `[task-name]-metadata.json` 更新的 `Deals` 信息


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs-cn.filswan.com/swan-client/chuang-jian-ren-wu-liu-cheng/filecoin-jiao-yi-fa-song-yin-qing/chuang-jian-ren-wu.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
