Skip to content

Pipeline lifecycle: development and production modes, and the deployment step - #314

Open
dimitri-yatsenko wants to merge 10 commits into
mainfrom
docs/development-and-production
Open

dimitri-yatsenko wants to merge 10 commits into
mainfrom
docs/development-and-production

Conversation

@dimitri-yatsenko

@dimitri-yatsenko dimitri-yatsenko commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

Summary

This PR defines development and production as two ways of operating a DataJoint pipeline, and specifies the lifecycle that connects them and the cycle a change goes through. DataJoint is designed to support both modes. They are enforced by database privileges, not by a DataJoint setting. The recommendations are a standard that individual deployments can vary.

The rule:

  • In development, the definition and the data may change together, from any process.
  • In production, the definition (tables, make() methods, Lookup contents) changes only in a deployment step, and run time changes only data.
  • Data may be copied from production to development. Rows move from development to production only as entry into Manual tables, through production's entry path. Computed rows never move.

Development is DataJoint's default. Most pipelines in use today are development pipelines, including many that others depend on. The production conventions are new, and nothing requires a pipeline to adopt them. A pipeline may stay in development for its whole life.

Development and production are separate pipelines. A development pipeline never becomes a production pipeline. A production pipeline is declared empty, from code, by its first deployment step. It fills only through production's own paths: entry and import for Manual and Imported tables, and workers for Computed tables. That way every production row is covered by production's provenance controls from the first. An existing pipeline is not converted in place.

The cycle of a change, drawn as a new figure:

  1. A temporary development pipeline is declared from the deployed code. It can live in a separate database, on a copy-on-write branch of the production database, or in memory where the tooling supports it.
  2. The change is designed and tried there. The development pipeline produces verified code, not data. A development pipeline may also keep running and serve production as an outside source of Manual rows.
  3. The change is reviewed and merged.
  4. The release checks each new or changed make() against the reproducibility contract.
  5. The deployment step applies the DDL. It is the only step that changes production's definition.
  6. Workers run make() from a fresh checkout of the deployed commit.

What changed

  • reference/specs/deploy-operations.md, now "Pipeline Lifecycle and Deployment". New sections come before the existing datajoint.deploy API:

    • terms: definition, data, target, pipeline, development pipeline, release, run time, worker, deployment step;
    • the rule, and the two modes compared;
    • the lifecycle, with two SVG figures (the lifecycle, and the cycle of a change):
      • development;
      • creating the production pipeline;
      • changing a production pipeline;
      • development and production as separate pipelines;
    • eleven recommendations for production:
      1. change the definition only in a deployment step;
      2. enforce it with database privileges;
      3. only workers populate, from a fresh checkout of the deployed commit;
      4. declare hidden tables ahead of time and turn off create_tables;
      5. keep Lookup tables for definition only;
      6. treat a changed make() as a change to the definition;
      7. preview a delete, then run it;
      8. classify each change as additive or revising;
      9. check make() at release;
      10. record where rows come from;
      11. move rows from development to production only as entry into Manual tables, with a list of what to watch for;
    • the deployment step, which starts from a release;
    • what DataJoint does at run time, and how a deployment step prepares for each behavior.

    The datajoint.deploy API keeps its content, under its own heading.

  • Additive and revising changes (a new section of the spec). An additive change extends the pipeline and leaves what exists as it was. A revising change removes, renames, narrows or constrains what running code reads or writes, or changes what existing rows mean. The section gives examples of each and says how each kind is managed.

  • How the modes differ (a new section of the spec):

    • intrinsic provenance, with job metadata recording the code version;
    • extrinsic provenance (_prov);
    • the make() reproducibility contract, with a table of where it is enforced: by DataJoint at run time, by review and release, and in production by privileges and workers;
    • Lookup seeding.
  • reference/specs/autopopulate.md: names the parts of the contract that DataJoint enforces at run time, and says the rest is checked at release.

  • explanation/development-and-production.md (new): the reasoning behind the two modes, the cycle of a change, why data moves one way only, and development as the default.

  • how-to/deploy-production.md: create_tables=False is part of production, not the whole of it. "Enable Production Mode" becomes "Turn Off Automatic Table Creation". The page also corrects when tables are declared: when the class is decorated, usually at import.

  • how-to/manage-pipeline-project.md: the "schema promotion" diagram now shows code moving to production and data moving to development only, and links to the lifecycle.

  • Inbound link text and navigation are updated.

The statements about library behavior were checked against datajoint-python master. In-memory drafting is datajoint/datajoint-python#1552 (2.4).

Open question

  • A formal conversion process. Should there be one for labs that want production's guarantees without re-entering their data? Pre-production rows would stay clearly identifiable as such. As written, there is no conversion: a pipeline either stays in development or gets a new production pipeline.

Follow-ups (not in this PR)

Define development and production as modes of a target, from first
principles: the definition (tables, make(), Lookup contents) changes
only in a deployment step in production, and run time changes only
data. The deploy-operations spec now specifies the lifecycle, the
recommendations for production, the deployment step and what DataJoint
does at run time, ahead of the datajoint.deploy API. A new explanation
page gives the reasoning. The production how-to and inbound links are
aligned: create_tables=False is part of production, not the whole.
…d Lookup seeding across modes

Introduce the two kinds of change to a production pipeline, additive and
revising, with examples and how each is managed in each mode. Specify how
intrinsic and extrinsic provenance, the make() reproducibility contract
and Lookup seeding differ between development and production, and where
the make() contract is enforced: by DataJoint at run time (populate-only
for master tables, the all-or-nothing write, reads through self.upstream,
the tripartite make_fetch re-check), at review and deployment, and
optionally by privileges. Align the autopopulate spec's statements on
enforcement.
populate() and make() run only in workers, from a clean checkout of the
committed code at the deployed version, so the git version recorded with
each computed row is the code that computed it. Worker logins alone may
insert into auto-populated tables and their parts; user logins read,
enter Manual data, and delete (previewed), which cascades through
auto-populated tables.
…deployment

A change to a production pipeline is designed on a temporary development
pipeline declared from the deployed code (in a separate database, on a
copy-on-write branch, or in memory). Its product is verified code: the
change is reviewed and merged, the release checks each make() against the
reproducibility contract, and the deployment step applies the DDL. Workers
populate from a fresh checkout of the deployed commit.

Data moves only from production to development (new recommendation 11).
A development pipeline never becomes production: the production pipeline
is declared empty from code, except that a pipeline others already depend
on adopts the standard in place.

Adds the change-cycle figure, marking where the contract is checked and
enforced and where DDL is applied, and redraws the lifecycle figure.
…ole life; no in-place conversion

Most pipelines in use today are development pipelines; the production
conventions are new and optional. A pipeline that wants production's
guarantees gets them in a new production pipeline declared from its code,
not by converting an existing target.
@dimitri-yatsenko
dimitri-yatsenko marked this pull request as ready for review November 24, 2026 23:01
…duction's entry path

Computed and Imported rows never move. A development pipeline, including
one that keeps running, can serve production as an outside source of
Manual rows, entered through production's entry path with provenance
capture on. Recommendation 11 lists what to watch for: test rows,
definition mismatch, upstream references, keys, stored objects, and
repeated transfers.
@dimitri-yatsenko

Copy link
Copy Markdown
Member Author

One change since review was requested: the one-way data rule now has a route for Manual rows.

  • Computed and Imported rows still never move from development to production. Production computes its own rows in workers.
  • Manual rows may be entered into production from a development pipeline, including one that keeps running alongside production. The development pipeline is treated as an outside source: rows go through production's entry path, with provenance capture on.
  • Recommendation 11 lists what to watch for: test and placeholder rows, definition mismatch, upstream references that exist only in development, key collisions (auto-increment included), stored objects, and transfers that run repeatedly.

The explanation page, both figures and the schema promotion section of the how-to are updated to match.

…pipelines for quick prototyping; how-to diagrams as SVG

The deployment step section lists what must happen (compare, classify,
pause, declare hidden tables, Lookup contents, data migration, grants,
environment, record, start) without specifying how; the step is carried
out by whatever deploys the pipeline. The manage-pipeline-project
development/production and branching diagrams are now SVG figures.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant