Skip to content

Codemap bind-maps - #53

Draft
rahmans1 wants to merge 2 commits into
PanDAWMS:masterfrom
rahmans1:codemap-bind
Draft

rahmans1 wants to merge 2 commits into
PanDAWMS:masterfrom
rahmans1:codemap-bind

Conversation

@rahmans1

@rahmans1 rahmans1 commented Nov 24, 2026 •

Copy link
Copy Markdown

Merge order

Order PR Needs
1 #52 shared tools nothing
2, any order #50 swf-epicprod, #51 swf-monitor, #54 panda-client #52
any time #53 bind-maps nothing

This PR: merge at any time. It needs none of the others and none of them needs it: it reads map dumps, whatever built them. The numbers under Read on real maps need the plugins of #50, #51 and #54 to reproduce, not to merge.

Merging one of #50, #51, #54 before #52 would bring #52's commits in with it; the rest then still merge cleanly. All five were merged together in a scratch branch with no conflict.

Summary

A map states its boundaries from its own code and leaves the far side unsaid. bamboo bind-maps reads two or more map dumps together and says what each crossing reaches. It needs nothing of the plugins that built the maps: it reads the fields every map is made of.

bamboo bind-maps panda.json other.json ... --dump bindings.json

A map uses what another system has and offers what it has itself. A port is one of either, read from the map, and a use binds to an offer of the same kind and key.

Kind A use is An offer is Key
http an outbound boundary whose far side is a URL path an endpoint (MapFragment.endpoints), with its inbound boundary /api/v1/job/kill
call an outbound boundary whose far side is a callable of a package any function the map names pandaclient.Client.submitJobs
table a shared_table boundary: schema.table, or the model class the code imports an entity's tables, a table record, each subject as a column jedi_tasks
message an outbound message boundary and the types sent to it (message_edges) each type a receiver takes (message_receivers) the type, at a destination
  • In an outbound boundary a name spelled file::name is the map's own function and any other is the far side's, whichever of interface and calls_out holds it. PanDA's map names the boundary by its own method; a map of code that calls out from anywhere names it by the outside interface.
  • A schema is the deployment's (ATLAS_PANDA / doma_panda), so a table binds by its own name and the binding notes both spellings.
  • A use nothing offers is left unbound with the reason. A message type a receiver takes that no map sends is listed apart.
  • The result is Bindings, an artifact of its own stamped with each map's version. The maps are not changed and BoundaryNode.resolution is not written: a binding holds between two versions and a dump is one version's.
  • A new kind of crossing is a reader of ports (register_reader) and, where the key alone does not decide, a matcher.

Changes

  • bamboo/codemap/bind.py — ports, readers, matchers, bind()
  • bamboo/scripts/bind_maps.py, bamboo/cli.py — the bind-maps command
  • tests/test_codemap_bind.py — four maps built by hand (a server shaped as PanDA's plugin shapes one, a client library, two applications); no plugin is run
  • website/.../code-map-building.md — "Binding maps to one another"

Read on real maps

PanDA (panda-server master 78463a7: 131 endpoints, 72 entities, 741 subjects, 185 boundaries) bound with a client library's map and two applications' maps (the other codemap-* branches): 206 crossings over 8 channels, in two seconds.

  • every one of the library's 55 requests reaches its endpoint and the inbound boundary it arrives by;
  • 17 of the 19 PanDA tables the applications name bind to PanDA's entities, and 111 of the columns they read to subjects (jobsactive4.jobstatus → JobSpec.jobStatus, which 37 PanDA functions write);
  • PanDA's own 77 uses stay unbound with the reason: no map given covers Rucio, DEFT, or the tables nothing in PanDA writes.

Test plan

  • pytest tests/test_codemap_bind.py — 15 passed
  • scripts/mypy_ratchet.py check — 0 errors; black and ruff clean on the touched files
  • Merged with the four other codemap-* branches in a scratch branch: no conflict, 66 tests pass
  • Full test suite (left to CI)

🤖 Generated with Claude Code

Sakib Rahman and others added 2 commits November 24, 2026 09:14
… from the fields a map has

A map states its boundaries from its own code and leaves the far side unsaid:
the far side is another distribution at a version of its own.
bamboo.codemap.bind reads two or more maps together and says what each
crossing reaches, with no knowledge of the plugins that built them.

A map uses what another system has and offers what it has itself.  A port is
one of either, read from the map's own fields, and a use binds to an offer of
the same kind and key:

* http: an outbound boundary whose far side is a URL path, to an endpoint
  (MapFragment.endpoints) and the inbound boundary of its function;
* call: an outbound boundary whose far side is a callable of a package, to a
  function a map names.  A client library is a map like any other, so a call
  binds to the library and the library's request to the server;
* table: a shared_table boundary -- schema.table, or the model class the code
  imports -- to an entity's tables, a table record and each subject as a
  column.  The schema is the deployment's, so a table binds by its own name
  and the binding notes both spellings;
* message: an outbound message boundary and the types sent to it
  (message_edges), to each type a receiver takes (message_receivers), where
  the destinations agree or the receiver states none.

In an outbound boundary a name spelled file::name is the map's own function
and any other is the far side's, whichever of interface and calls_out holds
it: PanDA's map names the boundary by its own method, a map of code that
calls out from anywhere names it by the outside interface.

A use nothing offers is left unbound with the reason -- no map given covers
the system, the map that covers it has no such node, the receiver has no
handler for the type.  A message type a receiver takes that no map sends is
listed apart.

The result is Bindings, an artifact of its own stamped with each map's
version: a binding holds between two versions and a dump is one version's, so
the maps are not changed and BoundaryNode.resolution is not written;
Bindings.resolution answers it.  A new kind of crossing is a reader of ports
(register_reader) and, where the key alone does not decide, a matcher.

  bamboo bind-maps panda.json other.json ... --dump bindings.json

The tests build four maps by hand -- a server shaped as PanDA's plugin shapes
one, a client library, two applications -- and run no plugin.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…eport gives one row per key reached

PanDA's entity of jedi_tasks lists the table as the corpus spells it,
JEDI_Tasks and jedi_tasks, and each spelling was an offer under the same key,
so a use of the table bound to it twice.  One offer per key of an entity.
The report merges the bindings of one key to one node, whichever boundaries
of the source cross to it.

Read on real maps: PanDA (panda-server master, 131 endpoints, 72 entities,
741 subjects) with a client library's and two applications' binds 206
crossings -- every request of the library to its endpoint, an application's
calls to the library, 17 of the 19 PanDA tables the applications name with
111 of their columns to subjects -- in two seconds.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

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