Jobs Overview

Execute one-time computational tasks.

When to Use Jobs

Good for Jobs

  • Batch data processing
  • ML model training
  • Video/image encoding
  • Report generation
  • Data migrations
  • Tests and CI/CD

Use Deployments Instead

  • Web servers
  • APIs that need to stay up
  • Databases
  • Long-running services
  • Anything that serves requests

Job Lifecycle

| State | Description | |-------|-------------| | pending | Job submitted, waiting for provider to pick up | | running | Executing on provider node | | completed | Finished successfully, result available | | failed | Error occurred, check logs for details |

Submitting a Job

Using the SDK:

const { KovaClient } = require('@kova/sdk');

const client = new KovaClient({
  apiUrl: 'https://test.kovanetwork.com',
  apiKey: 'your-api-key'
});

const job = await client.submitJob({
  image: 'python:3.11',
  cpu: 2,
  memory: 4,
  env: { SCRIPT: 'print("hello")' },
  maxPrice: 0.10
});

console.log('Job ID:', job.id);

Waiting for Results

const result = await client.waitForJob(job.id);

console.log('Status:', result.status);
console.log('Output:', result.output);
console.log('Cost:', result.cost);

Job Pricing

Jobs are billed based on:

  • CPU hours - Based on cores allocated
  • Memory hours - Based on RAM allocated
  • Execution time - Total runtime

Set maxPrice to limit your spending. The job will only run if a provider bids below your maximum.