# FlowDrop Job

> Content entity for individual workflow node execution records — tracking input, output, status, and errors for each node in a pipeline.

## Overview

The `flowdrop_job` module provides a content entity that represents the execution of a single workflow node within a pipeline. Each job tracks its execution status (pending, running, completed, failed), input/output data, and error information.

Jobs are created by the [flowdrop_pipeline](flowdrop_pipeline.md) module's job generation service and executed by the [flowdrop_runtime](flowdrop_runtime.md) orchestrators. They provide the granular tracking needed for monitoring, debugging, and retry logic in workflow execution.

This is a foundational module with no FlowDrop dependencies — it only requires Drupal core's `options` and `text` modules.

## Dependencies

- `drupal:options`
- `drupal:text`

## Configuration

### Admin Pages

| Path | Description |
|------|-------------|
| `/admin/flowdrop/jobs` | List all jobs |
| `/admin/flowdrop/jobs/{id}` | View job details (input, output, status, errors) |
| `/admin/flowdrop/structure/job-types` | Manage job type bundles |
| `/admin/flowdrop/structure/job-types/add` | Add a job type |
| `/admin/flowdrop/structure/job-types/{id}` | Edit a job type |

### Permissions

| Permission | Description |
|------------|-------------|
| `administer flowdrop_job types` | Manage job type bundles. Restricted. |
| `view flowdrop_job` | View job entities |
| `create flowdrop_job` | Create job entities |
| `edit flowdrop_job` | Edit job entities |
| `delete flowdrop_job` | Delete job entities |

## Tips and Tricks

### Job Lifecycle

Jobs follow a well-defined lifecycle:

1. **Pending** — Created by pipeline job generation, waiting for dependencies
2. **Running** — Currently being executed by an orchestrator
3. **Completed** — Execution finished successfully with output data
4. **Failed** — Execution encountered an error

### Viewing Job Results

The job view page at `/admin/flowdrop/jobs/{id}` shows the full execution details including input data, output data, execution duration, and any error messages. This is useful for debugging workflow issues — you can trace exactly what each node received and produced.

## Developer API

> All PHP classes in this module are `@internal` and not part of the stable public API. They may change without notice in any release. See the [BC Policy](../reference/api/bc-policy.md) for details.

### Entities

#### FlowDropJob (Content Entity)

A bundled content entity. Job types (bundles) are defined by `FlowDropJobType` config entities.

#### FlowDropJobType (Config Entity)

Bundle type for jobs. Allows different job types with varying field configurations.

### API Endpoints

| Method | Path | Description |
|--------|------|-------------|
| GET | `/api/flowdrop/pipeline/{pipeline_id}/jobs` | List all jobs in a pipeline |
| GET | `/api/flowdrop/pipeline/{pipeline_id}/job-status` | Get job status summary |
| GET | `/api/flowdrop/job/{job_id}` | Get job details |

## References

- [flowdrop_pipeline](flowdrop_pipeline.md) — creates jobs from workflow definitions
- [flowdrop_runtime](flowdrop_runtime.md) — executes jobs via orchestrators
