> For the complete documentation index, see [llms.txt](https://docs.roboflow.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.roboflow.com/roboflow/roboflow-hi/deploy/batch-processing/cli-usage.md).

# CLI Usage

इंस्टॉल करके `inference-cli` आपको पहुँच मिलती है `inference rf-cloud` कमांड, जो आपको Batch Processing और Data Staging के साथ इंटरैक्ट करने की अनुमति देता है — Roboflow Batch Processing के मुख्य घटक।

## सेटअप

```bash
pip install inference-cli
export ROBOFLOW_API_KEY="YOUR-API-KEY-GOES-HERE"
```

Cloud storage support के लिए:

```bash
pip install 'inference-cli[cloud-storage]'
```

यदि आपको अपना API key ढूँढने में मदद चाहिए, तो हमारा [authentication guide](https://docs.roboflow.com/api-reference/authentication).

## डेटा ingest करें

### छवियाँ

```bash
inference rf-cloud data-staging create-batch-of-images \
  --images-dir <your-images-dir-path> \
  --batch-id <your-batch-id>
```

### वीडियो

```bash
inference rf-cloud data-staging create-batch-of-videos \
  --videos-dir <your-videos-dir-path> \
  --batch-id <your-batch-id>
```

{% hint style="info" %}
**Batch ID का प्रारूप:** लोअरकेस में होना चाहिए, अधिकतम 64 वर्णों का, और केवल अक्षर, अंक, हाइफ़न (`-`), और अंडरस्कोर (`_`).
{% endhint %}

### Cloud Storage

यदि आपका डेटा पहले से ही cloud storage (S3, Google Cloud Storage, या Azure) में है, तो आप फ़ाइलें स्थानीय रूप से डाउनलोड किए बिना उसे सीधे process कर सकते हैं।

**छवियों के लिए:**

```bash
inference rf-cloud data-staging create-batch-of-images \
  --data-source cloud-storage \
  --bucket-path <cloud-path> \
  --batch-id <your-batch-id>
```

**वीडियो के लिए:**

```bash
inference rf-cloud data-staging create-batch-of-videos \
  --data-source cloud-storage \
  --bucket-path <cloud-path> \
  --batch-id <your-batch-id>
```

यह `--bucket-path` parameter निम्न का समर्थन करता है:

* **S3**: `s3://bucket-name/path/`
* **Google Cloud Storage**: `gs://bucket-name/path/`
* **Azure Blob Storage**: `az://container-name/path/`

फ़ाइलों को फ़िल्टर करने के लिए आप glob patterns शामिल कर सकते हैं:

* `s3://my-bucket/training-data/**/*.jpg` — सभी JPG फ़ाइलें recursively
* `gs://my-bucket/videos/2024-*/*.mp4` — 2024-\* फ़ोल्डरों में MP4 फ़ाइलें
* `az://container/images/*.png` — images folder में PNG फ़ाइलें

{% hint style="info" %}
आपके cloud storage credentials का उपयोग **केवल स्थानीय रूप से** CLI द्वारा presigned URLs जनरेट करने के लिए। वे **कभी भी upload नहीं किए जाते** Roboflow servers पर।
{% endhint %}

{% hint style="warning" %}
जनरेट किए गए presigned URLs 24 घंटे के लिए मान्य होते हैं। सुनिश्चित करें कि आपका batch processing job इस समय सीमा के भीतर पूरा हो जाए।
{% endhint %}

बड़े datasets के लिए, system स्वचालित रूप से images को 20,000 files के chunks में विभाजित करता है। Videos 1,000 से कम के batches में सबसे अच्छे काम करते हैं।

### Signed URL Ingestion

उन्नत automation के लिए, आप local files के बजाय signed URLs के माध्यम से data ingest कर सकते हैं:

* `--data-source references-file` — signed URLs के माध्यम से संदर्भित files process करें।
* `--references <path_or_url>` — file URLs वाली JSONL file का path, या ऐसी file की ओर इंगित करने वाला signed URL।

**Reference File Format (JSONL):**

```
{"name": "<unique-file-name-1>", "url": "https://<signed-url>"}
{"name": "<unique-file-name-2>", "url": "https://<signed-url>"}
```

{% hint style="info" %}
Signed URL ingestion Growth Plan और Enterprise ग्राहकों के लिए उपलब्ध है।
{% endhint %}

## Staged Data का निरीक्षण करें

```bash
inference rf-cloud data-staging show-batch-details --batch-id <your-batch-id>
```

## Job शुरू करें

### Images process करें

```bash
inference rf-cloud batch-processing process-images-with-workflow \
  --workflow-id <workflow-id> \
  --batch-id <batch-id> \
  --machine-type gpu
```

### Videos process करें

```bash
inference rf-cloud batch-processing process-videos-with-workflow \
  --workflow-id <workflow-id> \
  --batch-id <batch-id> \
  --machine-type gpu \
  --max-video-fps <your-desired-fps>
```

{% hint style="info" %}
**अपना Workflow ID ढूँढना:** Roboflow App में Workflow Editor खोलें, "Deploy" पर क्लिक करें, और code snippet में identifier ढूँढें।
{% endhint %}

{% hint style="info" %}
डिफ़ॉल्ट रूप से, processing CPU पर चलता है। उपयोग करें `--machine-type gpu` multiple या बड़े models वाले Workflows के लिए।
{% endhint %}

## Job प्रगति की निगरानी करें

start command एक **Job ID** आउटपुट करता है। स्थिति जाँचने के लिए इसका उपयोग करें:

```bash
inference rf-cloud batch-processing show-job-details --job-id <your-job-id>
```

## परिणाम एक्सपोर्ट करें

job details में शामिल होगा **output batch ID**। परिणाम एक्सपोर्ट करने के लिए इसका उपयोग करें:

```bash
inference rf-cloud data-staging export-batch \
  --target-dir <dir-to-export-result> \
  --batch-id <output-batch-of-a-job>
```

## Webhook Automation

स्थिति के लिए polling करने के बजाय, ingestion या processing पूरा होने पर सूचना पाने के लिए आप webhooks का उपयोग कर सकते हैं।

### Data Ingestion Webhooks

CLI कमांड्स `create-batch-of-images` और `create-batch-of-videos` समर्थन करते हैं:

* `--notifications-url <webhook_url>` — सूचनाओं के लिए webhook endpoint।
* `--notification-category <value>` — सूचनाओं को फ़िल्टर करें:
  * `ingest-status` (डिफ़ॉल्ट) — संपूर्ण ingestion process status।
  * `files-status` — अलग-अलग फ़ाइल processing status।

सूचनाएँ HTTP POST के माध्यम से एक `Authorization` header के साथ भेजी जाती हैं, जिसमें आपका Roboflow Publishable Key होता है।

#### Ingest Status Notification

```json
{
    "type": "roboflow-data-staging-notification-v1",
    "event_id": "8c20f970-fe10-41e1-9ef2-e057c63c07ff",
    "ingest_id": "8cd48813430f2be70b492db67e07cc86",
    "batch_id": "test-batch-117",
    "shard_id": null,
    "notification": {
        "type": "ingest-status-notification-v1",
        "success": false,
        "error_details": {
            "type": "unsafe-url-detected",
            "reason": "Untrusted domain found: https://example.com/image.png"
        }
    },
    "delivery_attempt": 1
}
```

#### File Status Notification

```json
{
    "type": "roboflow-data-staging-notification-v1",
    "event_id": "8f42708b-aeb7-4b73-9d83-cf18518b6d81",
    "ingest_id": "d5cb69aa-b2d1-4202-a1c1-0231f180bda9",
    "batch_id": "prod-batch-1",
    "shard_id": "0d40fa12-349e-439f-83f8-42b9b7987b33",
    "notification": {
        "type": "ingest-files-status-notification-v1",
        "success": true,
        "ingested_files": [
            "000000494869.jpg",
            "000000186042.jpg"
        ],
        "failed_files": [
            {
                "type": "file-size-limit-exceeded",
                "file_name": "big_image.png",
                "reason": "Max size of single image is 20971520B."
            }
        ],
        "content_truncated": false
    },
    "delivery_attempt": 1
}
```

### Job Completion Webhooks

जोड़ें `--notifications-url` job शुरू करते समय:

```bash
inference rf-cloud batch-processing process-images-with-workflow \
  --workflow-id <workflow-id> \
  --batch-id <batch-id> \
  --notifications-url <webhook_url>
```

#### Job Completion Notification

```json
{
  "type": "roboflow-batch-job-notification-v1",
  "event_id": "8f42708b-aeb7-4b73-9d83-cf18518b6d81",
  "job_id": "<your-batch-job-id>",
  "job_state": "success | fail",
  "delivery_attempt": 1
}
```

## Cloud Storage Authentication

### AWS S3 and S3-Compatible Storage

Credentials निम्न से स्वचालित रूप से detect किए जाते हैं:

1. **Environment variables:**

```bash
export AWS_ACCESS_KEY_ID=your-access-key-id
export AWS_SECRET_ACCESS_KEY=your-secret-access-key
export AWS_SESSION_TOKEN=your-session-token  # Optional
```

2. **AWS credential files** (`~/.aws/credentials`, `~/.aws/config`)
3. **IAM roles** (EC2, ECS, Lambda)

**Named profiles:**

```bash
export AWS_PROFILE=production
```

**S3-compatible services (Cloudflare R2, MinIO, आदि):**

```bash
export AWS_ENDPOINT_URL=https://account-id.r2.cloudflarestorage.com
export AWS_REGION=auto  # R2 requires region='auto'
export AWS_ACCESS_KEY_ID=your-r2-access-key
export AWS_SECRET_ACCESS_KEY=your-r2-secret-key
```

### Google Cloud Storage

Credentials निम्न से detect किए जाते हैं:

1. **Service account key file** (automation के लिए अनुशंसित):

```bash
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account-key.json
```

2. **User credentials** gcloud CLI से (`gcloud auth login`)
3. **GCP metadata service** (जब Google Cloud Platform पर चल रहा हो)

### Azure Blob Storage

**SAS Token (अनुशंसित):**

```bash
export AZURE_STORAGE_ACCOUNT_NAME=mystorageaccount
export AZURE_STORAGE_SAS_TOKEN="sv=2021-06-08&ss=b&srt=sco&sp=rl&se=2024-12-31"
```

**Account Key:**

```bash
export AZURE_STORAGE_ACCOUNT_NAME=mystorageaccount
export AZURE_STORAGE_ACCOUNT_KEY=your-account-key
```

Azure CLI के माध्यम से SAS token जनरेट करें:

```bash
az storage container generate-sas \
  --account-name mystorageaccount \
  --name my-container \
  --permissions rl \
  --expiry 2024-12-31T23:59:59Z
```

### Custom Scripts

उन्नत use cases के लिए, signed URL files जनरेट करने हेतु scripts देखें:

* **AWS S3:** [generateS3SignedUrls.sh](https://raw.githubusercontent.com/roboflow/roboflow-python/main/scripts/generateS3SignedUrls.sh)
* **Google Cloud Storage:** [generateGCSSignedUrls.sh](https://github.com/roboflow/roboflow-python/blob/main/scripts/generateGCSSignedUrls.sh)
* **Azure Blob Storage:** [generateAzureSasUrls.sh](https://raw.githubusercontent.com/roboflow/roboflow-python/main/scripts/generateAzureSasUrls.sh)

## सभी विकल्प खोजें

```bash
inference rf-cloud --help
inference rf-cloud data-staging --help
inference rf-cloud batch-processing --help
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.roboflow.com/roboflow/roboflow-hi/deploy/batch-processing/cli-usage.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
