CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-modal

Python client library for Modal, a serverless cloud computing platform that enables developers to run Python code in the cloud with on-demand access to compute resources.

85

1.60x
Overview
Eval results
Files

task.mdevals/scenario-7/

Adaptive Image Processing Service

Build a serverless image processing service that handles varying workload patterns with different scaling requirements for two distinct processing endpoints.

Requirements

Background Processing Endpoint

Create a background image processing function that:

  • Handles batch image transformations that may take 30-60 seconds per image
  • Should maintain at least 2 containers running at all times to handle incoming requests quickly
  • Should never exceed 10 containers to control costs
  • Should keep 3 additional containers pre-warmed and ready to handle sudden traffic spikes
  • Should wait 5 minutes of idle time before scaling down containers
  • Each container should process one image at a time to ensure quality and prevent memory issues

Real-time Processing Endpoint

Create a real-time image thumbnail generation function that:

  • Handles quick thumbnail generation (1-2 seconds per request)
  • Should allow each container to process up to 5 requests concurrently
  • Should target 3 concurrent requests per container as optimal for autoscaling decisions
  • Has no minimum container requirement (can scale to zero when idle)
  • Should handle up to 50 containers maximum during peak traffic

Test Cases

  • The background processing function should be configured with minimum 2 containers running @test
  • The background processing function should be configured with maximum 10 containers @test
  • The background processing function should have 3 buffer containers pre-warmed @test
  • The background processing function should have a scaledown window of 300 seconds @test
  • The background processing function should allow 1 concurrent input per container @test
  • The real-time processing function should allow 5 concurrent inputs maximum per container @test
  • The real-time processing function should target 3 concurrent inputs per container @test
  • The real-time processing function should allow maximum 50 containers @test

Implementation

@generates

API

"""
Image processing service with adaptive scaling configuration.
"""

def process_background_image(image_url: str) -> dict:
    """
    Process an image with comprehensive transformations for background jobs.

    Args:
        image_url: URL of the image to process

    Returns:
        Dictionary containing processing results with keys 'status' and 'output_url'
    """
    pass

def generate_thumbnail(image_url: str) -> dict:
    """
    Generate a thumbnail from an image for real-time requests.

    Args:
        image_url: URL of the image to process

    Returns:
        Dictionary containing thumbnail generation results with keys 'status' and 'thumbnail_url'
    """
    pass

Dependencies { .dependencies }

modal { .dependency }

Provides serverless compute platform with auto-scaling capabilities.

Install with Tessl CLI

npx tessl i tessl/pypi-modal

tile.json