CLI Reference Guide

The Manta SDK Command Line Interface (CLI) provides comprehensive tools for configuring, deploying, and managing distributed computing workloads from your terminal.

manta --help

Overview

The Manta CLI is organized into logical command groups for different operations:

  • config - SDK configuration and credential management

  • cluster - Cluster operations and monitoring

  • module - Module management and deployment

  • swarm - Swarm deployment and control

  • results - Result retrieval and analysis

  • globals - Global state management

  • logs - Log collection and streaming

Installation

Install with CLI Support

# Install SDK with CLI
pip install manta-sdk[cli]

# Or install complete SDK
pip install manta-sdk[full]

# Enable shell completion (optional)
manta --install-completion

Verify Installation

# Check version
manta --version

# View help
manta --help

# Check configuration
manta config status

Command Structure

The CLI follows a consistent command structure:

manta [OPTIONS] COMMAND [SUBCOMMAND] [ARGS]

Global Options

--config PATH        # Use specific configuration file
--profile NAME       # Use named profile
--format FORMAT      # Output format (json, table, yaml)
--verbose           # Enable verbose output
--quiet             # Suppress non-essential output
--help              # Show help message

Quick Start

Initial Configuration

# Interactive setup
manta config init --interactive

# Or manual configuration
manta config set --host localhost --port 50052
manta config set --token "your_jwt_token"

# Verify connection
manta config test

Basic Workflow

# List available clusters
manta cluster list

# Deploy a swarm
manta swarm deploy --file my_swarm.py --cluster-id abc123

# Monitor execution
manta swarm status --swarm-id xyz789

# Retrieve results
manta results get --swarm-id xyz789 --tag metrics

Common Commands

Configuration Management

manta sdk config init                    # Initialize configuration
manta sdk config show                     # Display current config
manta sdk config profiles list            # List profiles
manta sdk config profiles set-active dev # Switch profile

Cluster Operations

manta sdk cluster list                    # List all clusters
manta sdk cluster show CLUSTER_ID         # Show cluster details
manta sdk cluster nodes CLUSTER_ID        # List cluster nodes

Module Management

manta sdk module list                     # List modules
manta sdk module upload FILE              # Upload new module
manta sdk module show MODULE_ID           # Show module details
manta sdk module remove MODULE_ID         # Remove module

Swarm Deployment

manta sdk swarm deploy --file swarm.py    # Deploy swarm
manta sdk swarm list                      # List swarms
manta sdk swarm show SWARM_ID             # Check status
manta sdk swarm stop SWARM_ID             # Stop execution
manta sdk swarm remove SWARM_ID           # Delete swarm

Result Collection

manta sdk results list --swarm-id ID      # List available results
manta sdk results get --swarm-id ID --tag TAG  # Download results
manta sdk results delete --swarm-id ID --tag TAG  # Delete results

Log Management

manta sdk logs get SWARM_ID              # Get logs
manta sdk logs stream SWARM_ID           # Stream live logs
manta sdk logs get SWARM_ID --severity ERROR  # Filter by severity

Output Formats

The CLI supports multiple output formats:

Table Format (default)

manta cluster list

┏━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━┳━━━━━━━━━┓
┃ Cluster ID  Name        Nodes  Status  ┃
┡━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━╇━━━━━━━━━┩
│ abc123      Production  10     Active  │
│ def456      Development│ 3      Active  │
└────────────┴────────────┴───────┴─────────┘

JSON Format

manta cluster list --format json

[
  {
    "cluster_id": "abc123",
    "name": "Production",
    "nodes": 10,
    "status": "Active"
  }
]

YAML Format

manta cluster list --format yaml

- cluster_id: abc123
  name: Production
  nodes: 10
  status: Active

Environment Variables

The CLI respects environment variables for configuration:

export MANTA_HOST=platform.manta.io
export MANTA_PORT=50052
export MANTA_TOKEN=your_jwt_token
export MANTA_PROFILE=production
export MANTA_CONFIG_DIR=~/.manta

Shell Completion

Enable tab completion for your shell:

Bash

manta --install-completion bash
source ~/.bashrc

Zsh

manta --install-completion zsh
source ~/.zshrc

Fish

manta --install-completion fish
source ~/.config/fish/config.fish

Interactive Mode

Some commands support interactive mode for easier use:

# Interactive configuration
manta config init --interactive

# Interactive swarm deployment
manta swarm deploy --interactive

# Interactive module upload
manta module upload --interactive

Error Handling

The CLI provides clear error messages with suggestions:

$ manta cluster show invalid-id

Error: Cluster not found: invalid-id

Suggestions:
- Check cluster ID with: manta cluster list
- Verify your access permissions
- Ensure cluster exists in current profile

Exit Codes

The CLI uses standard exit codes:

  • 0: Success

  • 1: General error

  • 2: Misuse of command

  • 3: Configuration error

  • 4: Connection error

  • 5: Authentication error

  • 6: Resource not found

  • 7: Operation timeout

Best Practices

Use Profiles for Environments

Separate development and production configurations

Enable Verbose Mode for Debugging

Use --verbose to see detailed operation logs

Pipe Output for Processing

Use --format json for programmatic processing

Store Tokens Securely

Never commit tokens to version control

Use Shell Aliases

Create shortcuts for common commands

Examples

Deploy and Monitor Workflow

# Deploy a federated learning swarm
SWARM_ID=$(manta swarm deploy \
  --file fl_mnist.py \
  --cluster-id prod-cluster \
  --format json | jq -r .swarm_id)

# Monitor execution
manta swarm status $SWARM_ID --watch

# Stream logs
manta logs stream --swarm-id $SWARM_ID

# Get results when complete
manta results get --swarm-id $SWARM_ID \
  --tag accuracy \
  --format csv > results.csv

Batch Operations

# Stop all swarms in error state
manta swarm list --status ERROR --format json | \
  jq -r '.[].swarm_id' | \
  xargs -I {} manta swarm stop {}

# Export logs for multiple swarms
for swarm in $(manta swarm list --format json | jq -r '.[].swarm_id'); do
  manta logs export --swarm-id $swarm --output logs/${swarm}.json
done

Troubleshooting

Connection Issues

# Test connection
manta config test

# Check service status
manta config status --verbose

# Diagnose configuration
manta config doctor

Authentication Problems

# Refresh token
manta config set --token "new_token"

# Verify token
manta config verify-token

# Check permissions
manta config permissions

Performance Issues

# Enable caching
manta config set --cache-enabled true

# Adjust timeout
manta config set --timeout 60

# Use pagination
manta swarm list --limit 10 --offset 0

Next Steps