# Compute jobs

Hand heavy work, like 3D processing or video rendering, to a worker or GPU machine, with files in your module's storage.

Some work is too heavy for a module's everyday home: turning hundreds of photos into a 3D scene, rendering a video, crunching a giant import. **Compute jobs** hand that work to a separate worker machine, with a graphics card (GPU) when it needs one, and bring the results back into your module's storage. Your module just says "run this job" and checks on it.

## How a compute job works

```flow
Your module: Submit job -> Platform picks the worker and machine -> Worker runs // GPU or CPU
Worker: Reads inputs from storage -> Writes results to storage -> Reports back to your module
```

1. Your module **submits** a job of an approved kind, with a reference (your own record's id), whether it needs a GPU, and which files to read and write.
2. The platform chooses the worker, the machine and where it runs: its cloud, a local machine, or the workspace's own Bridge computer. It holds every credential.
3. The worker does the work and calls your module back as it goes. The platform routes those calls to your workspace only.
4. Your module checks the job's status, can **cancel** it, and marks it **finished** (succeeded or failed).

## Job kinds the platform approves

Your module never brings its own worker. Each **kind** of job is set up on the platform, approved for named modules, with its own worker and a time limit.

| Kind | What it does | Used by |
|---|---|---|
| 3D splat processing | Turns photos and video into a 3D scene, on a GPU (up to 24 hours a job) | Digital Twin |
| Video render | Renders finished videos, no GPU | Video Studio |

Need a different kind of heavy lifting? That's a platform change: ask Data Visions. Meanwhile, plenty of "heavy" work fits in your module itself, using the Python packages every workspace already has (PDF pages to images, spreadsheets, image processing). See [Outside hosts and Python packages](article:baafd354-25e5-4f82-be3a-dc12db34a77d).

## Inputs and outputs in storage

Jobs read and write files in **your module's own storage**, never anywhere else.

- **Inputs:** up to 50 files from your module's folders, such as the uploaded clips.
- **Outputs:** up to 50 files, each with a folder, a file name, a type and an expected size. The platform signs an upload address for exactly those files, so the worker can't write anywhere else.
- **Settings for the worker:** a few short, plain values (up to 32), like your job's id. They can't override the names the platform uses for itself.

So your module needs a storage folder for the job's files. See [Storage: files and photos](article:4c8a50b6-7a7d-4f07-b1fe-b8748ecddd6f).

## Ask the Module Builder

> *"When a user uploads a walkthrough video, start a 3D processing job on a GPU, show its progress on the scan's page, and save the finished model in the Scans folder."*

```python
# For developers: submit and track a job (an approved kind only)
jobs = module_compute_jobs("MY_MODULE", user.tenant_slug, user.tenant_id, user.user_id)
job = await jobs.submit("splat_worker", ref=scan_id, accelerator="gpu",
                        inputs=["uploads/clip.mp4"],
                        outputs=[{"folder": "scans", "filename": "scene.ply",
                                  "content_type": "application/octet-stream",
                                  "size_bytes": 512_000_000}])
status = await jobs.get(job["id"])
```

## Good to know

- **Compute time is metered:** the time each job runs, split by CPU and GPU type, per module. See [What a module costs to run](article:dd966d79-6c2d-43c0-8d6e-3dff5886192d).
- **Your module sees only its own jobs,** for its own workspace.
- **A finished or cancelled job is closed.** Late callbacks from its worker are refused.
- **Store the job's id on your record,** so the page can show progress and the result when it's done.


Source: https://datavisions.ai/docs/creators/platform-services/compute-jobs
