Developing Jobs¶
Jobs are Python classes that define custom automation logic in Nautobot. This guide will help you write, structure, test, and deploy Jobs that run within Nautobot's execution engine.
Before you begin, make sure you're familiar with:
Where is Job code stored?
Nautobot does not store Job code in the database. Instead, it loads Python classes from your file system or installed packages. The Job record stores only metadata — like name, description, and enabled state.
Job Development Workflow¶
Each of the pages below builds on the previous, from creating a Job to testing it in CI.
-
Getting Started
Write and run your first Job. Learn the minimum required structure and how to register and enable it in Nautobot. -
Installing Jobs
Choose where your Jobs live: inJOBS_ROOT
, inside a Git repository, or bundled with a custom Nautobot App. Understand the pros and cons of each. -
Job Structure
Define metadata, variables, and the requiredrun()
method. Learn how Job lifecycle methods work and how input gets passed in. -
Common Patterns
Build Jobs that do more — read files, generate logs, return results, validate data, or act on user input. Includes tested snippets. -
Job Extensions
Go beyond manual runs. Trigger Jobs from the UI (Job Buttons) or automatically on data changes (Job Hooks). -
Testing Jobs
Use Nautobot'srun_job_for_testing()
helper and Django'sTransactionTestCase
to test Jobs like any other Python code. Includes cProfile tips.
Migrating from Nautobot v1¶
Jobs in Nautobot v2 use a different structure than those in v1. If you're upgrading existing Jobs, start here: