location-arrowQueue-based Elastic Deployment Quickstart

Welcome! This guide will walk you through setting up and testing YottaLabs' queue-based elastic deployment from start to finish.


What You'll Accomplish

By the end of this guide, you'll have:

  • ✅ Built a queue-compatible worker image

  • ✅ Deployed it as a QUEUE elastic deployment

  • ✅ Submitted tasks through the Queue API

  • ✅ Monitored task status in real-time

  • ✅ Retrieved and verified task results

  • ✅ Confirmed a complete end-to-end workflow


Understanding the Queue Model

How It Works

In QUEUE mode, YottaLabs operates with the following flow:

Your Client (curl or Python)

   Sends: POST /skywalker/tasks/create

Yotta Queue System

   Sends: HTTP POST with taskData

Your Worker Container (Docker)

   Receives: FastAPI endpoint (/run)

Your handler(job) function

   Returns: result

Yotta Queue System

   Stores: taskResult for retrieval

Step 1: Build Your Worker

1.1 Create Your Business Logic

First, let's create handler.py — this is where your core logic lives. This is a super easy example of "echoing" what you prompted back to you.

File: handler.py

1.2 Create the HTTP Server

Now let's wrap your handler with FastAPI so YottaLabs can communicate with it.

File: server.py

What's happening here? YottaLabs sends your task data to the /run endpoint, and your server passes it to your handler function.


Step 2: Package Everything in Docker

2.1 Define Dependencies

File: requirements.txt

2.2 Create Your Dockerfile

File: Dockerfile

2.3 Build and Test Locally

Build your image:

Run it locally:

Test that it works:

You should see:

Great! Your worker is ready for deployment.

Push the image to Dockerhub for future use. Create,for example, yotta-queue-test:latest as my image name and tag.


Step 3: Deploy to YottaLabs

Create Your Elastic Deployment

Head to the YottaLabs Console and configure:

Setting
Value

Service Mode

QUEUE

Image

yotta-queue-test (or your image name)

Worker Port

8000

Wait for deployment to complete — you'll see Status = RUNNING when ready.

Save Your Endpoint ID

You'll receive an Endpoint ID that looks like this:

⚠️ Important: Endpoint ID is NOT worker ID shown at the bottom of detail page. Use the code below to get your Endpoint ID list


Step 5: Full Python Integration Test

For a more robust testing workflow, let's use Python.

Complete Test Script

File: test_remote.py

Run Your Test

Expected Output


Next Steps

Ready to take things further? Consider exploring:

  • Batch Processing — Submit multiple tasks at once

  • Monitoring — Add observability and metrics tracking


Need more help? Check out:

Last updated

Was this helpful?