Tasks

Overview

Tasks in Tapitalee are one-time or on-demand container executions used for background jobs, data migrations, administrative scripts, and maintenance operations. Unlike processes that run continuously, tasks execute once and terminate, making them ideal for batch processing, database migrations, and ad-hoc operations.

Purpose and Benefits

  • Background Processing: Execute long-running jobs without blocking web requests
  • Data Migration: Run database migrations and data transformation scripts
  • Administrative Tasks: System maintenance, cleanup, and configuration tasks
  • Scheduled Jobs: One-time or recurring batch operations
  • Resource Efficiency: Pay only for execution time, not idle time

How Tasks Work

Task Execution

Tasks run as:

  • ECS Tasks: One-time container execution in your cluster environment
  • Isolated Execution: Separate from running processes with dedicated resources
  • Environment Access: Full access to app environment variables and network
  • Resource Limits: Configurable CPU, memory, and execution time limits
  • Logging: Complete execution logs available for monitoring and debugging

CLI Usage

Create Background Task

tapit  create task 'background command here' [-w|--wait] [memory|cpu|docker_tag|image|max_hours|initiated_by]=value

Required Parameters

  • command: Shell command to execute (quoted string)

Optional Parameters

  • --wait: Wait for task completion before returning
  • memory: Memory allocation in GB (sandbox limit applies)
  • cpu: CPU allocation in vCPUs (sandbox limit applies)
  • docker_tag: Specific Docker image tag to use
  • image: Custom container image
  • max_hours: Maximum execution time in hours
  • initiated_by: Person or system starting the task

Examples

# Simple background job
tapit create task 'python scripts/process_data.py'

# Database migration with wait
tapit create task 'python manage.py migrate' --wait

# Resource-intensive task
tapit create task 'python ml_training.py' memory=4.0 cpu=2.0 max_hours=6

# Task with specific image version
tapit create task 'npm run build' docker_tag=v1.2.3 initiated_by=john.doe

Interactive Task (Run Command)

tapit  run 'bash' [memory|cpu|docker_tag|image|max_hours]=value

Starts an interactive shell session for debugging and development.

Examples

# Interactive bash shell
tapit run 'bash'

# Python shell for debugging
tapit run 'python'

# Database shell access
tapit run 'psql $DATABASE_URL'

# Custom shell with more resources
tapit run 'bash' memory=2.0 cpu=1.0

# Shell with specific image version
tapit run 'bash' docker_tag=v1.2.3

List Tasks

tapit  list tasks

Shows all tasks with their status, execution time, and metadata.

Show Task Details

tapit  show task task=<task_id>

Displays comprehensive information about a specific task execution.

Delete Task

tapit  delete task task=id123

Stops a running task or removes a completed task from the list.

Task Patterns and Use Cases

Database Migrations

# Django migration
tapit create task 'python manage.py migrate' --wait

# Rails migration  
tapit create task 'bundle exec rails db:migrate' --wait

Development and Debugging

# Interactive debugging & filesystem exploration
tapit run 'bash'

# Application console
tapit run 'python manage.py shell'

Task Configuration

Environment Variables

Tasks inherit all app environment variables automatically:

  • Database connections from add-ons
  • API keys and secrets
  • Application configuration