In this section
- Marine Workflow automation · opensea / .github/workflows/marine.yml lines 1–59
- Build Marine storage · opensea / scripts/build_marine.py lines 1–256
- Test Marine test · opensea / tests/test_marine.py lines 1–81
- Nightly Workflow automation · particle-physics-drawing-engine / .github/workflows/nightly.yml lines 1–89
- Particles Workflow automation · particle-physics-drawing-engine / .github/workflows/particles.yml lines 1–59
Marine Workflow
A GitHub Actions workflow in Opensea. Runs on push, on pull requests and on a schedule.
automationopensea / .github/workflows/marine.yml · lines 1–59 of 59 · Entry point
- What it does
- It runs automated jobs on GitHub Actions. Side effects: starts processes.
- Inputs & outputs
- Out: commits pushed to the repository.
- Downstream impact
- It is itself an entry point (workflow); no other file was found loading it.
- What it achieves
- Named “OpenSea regional seamark pipeline”; runs Build Marine (`scripts/build_marine.py`).
- Why it matters
- No other file in the estate was found to import it; it is an entry point.
- Application
- opensea · .github/workflows · workflow
- Uses
- Test Marine (workflow run), Build Marine (workflow run)
- Used by
- none found
- Produces
- none declared
- Defines here
- OpenSea regional seamark pipeline
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- opensea@93a4b5c996596d10d9bf3ec99a86338cf22f2029 .github/workflows/marine.yml:1-59 · blob 58c25e29c9582cf1c67bc14cb85d8da391ca165d · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: unknown · effects: process · domain stage: unknown · users: none · canonical: unknown
name: OpenSea regional seamark pipeline
on:
pull_request:
paths: ['scripts/**', 'tests/**', 'config/**', 'requirements.txt', '.github/workflows/marine.yml']
push:
branches: [main]
paths: ['scripts/**', 'tests/**', 'config/**', 'requirements.txt', '.github/workflows/marine.yml']
schedule:
- cron: '23 4 * * 1'
workflow_dispatch:
permissions:
contents: read
concurrency:
group: opensea-marine-${{ github.ref }}
cancel-in-progress: false
jobs:
tests:
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- run: python -m pip install -r requirements.txt
- run: python -m unittest discover -s tests -v
regional-build:
needs: tests
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
runs-on: ubuntu-24.04
timeout-minutes: 30
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- run: python -m pip install -r requirements.txt
- run: sudo apt-get update && sudo apt-get install -y osmium-tool
- name: Build and verify two bounded coastal extracts
run: |
python scripts/build_marine.py --region isle-of-wight --region hampshire --snapshot "$GITHUB_RUN_ID-$GITHUB_RUN_ATTEMPT" --out .
- uses: actions/upload-artifact@v4
with:
name: solent-marine-data
path: |
data/current.json
data/versions/${{ github.run_id }}-${{ github.run_attempt }}/
if-no-files-found: error
- name: Publish immutable pilot version and atomic current pointer
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add data/current.json "data/versions/$GITHUB_RUN_ID-$GITHUB_RUN_ATTEMPT"
git commit -m "Publish validated OpenSea regional snapshot $GITHUB_RUN_ID-$GITHUB_RUN_ATTEMPT"
git push origin HEAD:mainBuild Marine
A Python command-line tool in the scripts folder of Opensea that fetches regions, using SHA-256.
storageopensea / scripts/build_marine.py · lines 1–256 of 256 · Entry point · pattern export (shared by 3 files)
- What it does
- It fetches regions. Defines 22 functions or classes, including canonical, write_json, checksum, point, location. Uses libraries argparse, hashlib, json, math, re. Side effects: reads or writes files; makes network requests; starts processes; uses storage (browser storage, DuckDB or Parquet).
- Inputs & outputs
- In: JSON file current.json; JSON file regions.json; DuckDB queries; command-line arguments. Out: Parquet file.
- Downstream impact
- Used directly by 2 files: Marine Workflow (opensea); Test Marine (opensea).
- What it achieves
- It writes JSON (`write_json`) and is built from the canonical step (`canonical`) and the checksum step (`checksum`). Bounded OSM seamark PBF ingestion and versioned GridAtlas data export. It writes `manifest.json`. It accepts `--region`, `--snapshot` and `--out`.
- Why it matters
- Run by Marine Workflow. Checked by Test Marine.
- Application
- opensea · scripts · Python CLI
- Uses
- argparse, hashlib, json, math, re, subprocess, tempfile, datetime
- Used by
- run by Marine Workflow (workflow run), imported by Test Marine (sys.path import)
- Produces
- canonical, write_json, checksum, point, location, line_geometry, Reader, ingest, validate, stitch, fetch, acquire
- Defines here
- canonical, write_json, checksum, point, location, line_geometry, Reader, __init__, flush, emit, node, way, relation, ingest, validate, stitch, fetch, acquire, asset, export, build, main
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- opensea@93a4b5c996596d10d9bf3ec99a86338cf22f2029 scripts/build_marine.py:1-256 · blob 63bc86ae01b8ca7a14f0f37fde3a052a80f25da8 · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: filesystem, network, process, storage · domain stage: unknown · users: none · canonical: supporting_data
"""Bounded OSM seamark PBF ingestion and versioned GridAtlas data export."""
import argparse
import hashlib
import json
import math
import re
import subprocess
import tempfile
from datetime import datetime, timezone
from pathlib import Path
import duckdb
import osmium
ROOT = Path(__file__).resolve().parents[1]
ATTR = "© OpenStreetMap contributors"
LICENSE = "https://opendatacommons.org/licenses/odbl/1-0/"
SAFETY = "Community reference data only; not for marine navigation."
COLS = "osm_type, osm_id, osm_version, seamark_type, name, tags_json, geometry_json, geometry_state, member_json, region"
DDL = """CREATE TABLE features (
osm_type VARCHAR NOT NULL, osm_id BIGINT NOT NULL, osm_version INTEGER NOT NULL,
seamark_type VARCHAR NOT NULL, name VARCHAR, tags_json VARCHAR NOT NULL,
geometry_json VARCHAR, geometry_state VARCHAR NOT NULL, member_json VARCHAR,
region VARCHAR NOT NULL)"""
def canonical(value):
return json.dumps(value, ensure_ascii=False, sort_keys=True, separators=(",", ":"), allow_nan=False)
def write_json(path, value):
path.write_text(canonical(value) + "\n", encoding="utf-8")
def checksum(path, algorithm="sha256"):
with path.open("rb") as f:
return hashlib.file_digest(f, algorithm).hexdigest()
def point(lon, lat):
if not (math.isfinite(lon) and math.isfinite(lat) and -180 <= lon <= 180 and -90 <= lat <= 90):
return None
return [lon, lat]
def location(loc):
return point(loc.lon, loc.lat) if loc.valid() else None
def line_geometry(coords):
if len(coords) < 2 or any(p is None for p in coords):
return None, "missing_coordinates"
if any(abs(a[0]-b[0]) > 180 for a,b in zip(coords, coords[1:])):
return None, "antimeridian_unresolved"
if len({tuple(p) for p in coords}) < 2:
return None, "degenerate_line"
return {"type":"LineString","coordinates":coords}, "resolved"
class Reader(osmium.SimpleHandler):
def __init__(self, db, region):
super().__init__()
self.db, self.region, self.rows = db, region, []
def flush(self):
if self.rows:
self.db.executemany("INSERT INTO features VALUES (?,?,?,?,?,?,?,?,?,?)", self.rows)
self.rows.clear()
def emit(self, obj, kind, geom, state, members=None):
tags = dict(obj.tags)
seamark = tags.get("seamark:type")
if not seamark:
return
if obj.id <= 0 or obj.version < 1:
raise ValueError("invalid source identity/version")
self.rows.append((kind, obj.id, obj.version, seamark, tags.get("name"), canonical(tags),
canonical(geom) if geom else None, state,
canonical(members) if members is not None else None, self.region))
if len(self.rows) >= 2000:
self.flush()
def node(self, obj):
if "seamark:type" not in obj.tags:
return
p = location(obj.location)
self.emit(obj, "node", {"type":"Point","coordinates":p} if p else None,
"resolved" if p else "missing_coordinates")
def way(self, obj):
if "seamark:type" not in obj.tags:
return
geom, state = line_geometry([location(n.location) for n in obj.nodes])
self.emit(obj, "way", geom, state)
def relation(self, obj):
if "seamark:type" not in obj.tags:
return
members = [{"type":m.type,"ref":m.ref,"role":m.role} for m in obj.members]
self.emit(obj, "relation", None, "relation_unresolved", members)
def ingest(db, path, region):
reader = Reader(db, region)
reader.apply_file(str(path), locations=True, idx="flex_mem")
reader.flush()
validate(db, "features", region=region)
def validate(db, table, region=None):
# table names are internal constants, never source strings.
if table not in ("features","stitched"):
raise ValueError("invalid table")
where = " WHERE region=?" if region is not None else ""
args = [region] if region is not None else []
n, unique = db.execute(f"SELECT count(*),count(DISTINCT (osm_type,osm_id)) FROM {table}"+where,args).fetchone()
if n == 0 or n != unique:
raise ValueError(f"empty or duplicate source identities: {table} {region}")
invalid = db.execute(f"SELECT count(*) FROM {table}"+where+
(" AND " if where else " WHERE ")+"((geometry_json IS NULL) <> (geometry_state <> 'resolved'))",args).fetchone()[0]
if invalid:
raise ValueError("geometry state mismatch")
return n
def stitch(db):
db.execute("""CREATE TEMP VIEW newest AS SELECT * FROM features
QUALIFY osm_version=max(osm_version) OVER(PARTITION BY osm_type,osm_id)""")
conflicts = db.execute("""SELECT osm_type,osm_id FROM newest
GROUP BY osm_type,osm_id HAVING count(DISTINCT tags_json)>1
OR count(DISTINCT member_json)>1 OR count(DISTINCT geometry_json)>1 LIMIT 1""").fetchone()
if conflicts:
raise ValueError(f"same-version source conflict: {conflicts}")
db.execute("""CREATE TABLE stitched AS SELECT * FROM newest
QUALIFY row_number() OVER(PARTITION BY osm_type,osm_id
ORDER BY (geometry_json IS NOT NULL) DESC, region, geometry_state)=1""")
return validate(db,"stitched")
def fetch(url, dest):
# Bounded public extract downloads; never use public map tile or Overpass scraping.
subprocess.run(["curl","--fail","--location","--retry","2","--max-time","600",
"--max-filesize","500000000","--silent","--show-error","-o",str(dest),url],check=True)
def acquire(region, url, work):
src = work / (region+".osm.pbf")
md5 = work / (region+".md5")
fetch(url+".md5",md5)
fetch(url,src)
expected = md5.read_text(encoding="ascii").split()[0].lower()
if not re.fullmatch(r"[0-9a-f]{32}",expected) or checksum(src,"md5") != expected:
raise ValueError("provider checksum mismatch; retry on next build")
timestamp = subprocess.check_output(["osmium","fileinfo","-g","header.option.osmosis_replication_timestamp",str(src)],text=True).strip()
filtered = work / (region+"-filtered.osm.pbf")
subprocess.run(["osmium","tags-filter",str(src),"nwr/seamark:type","-o",str(filtered)],check=True)
return filtered, {"region":region,"url":url,"provider_md5":expected,
"source_sha256":checksum(src),"source_bytes":src.stat().st_size,
"replication_timestamp":timestamp or None}
def asset(path, root):
size = path.stat().st_size
if size > 10_000_000:
raise ValueError("pilot asset exceeds 10 MB; partition before publication")
return {"path":path.relative_to(root).as_posix(),"bytes":size,"sha256":checksum(path)}
def export(db, table, name, snapshot, root, region=None):
where = " WHERE region=?" if region else ""
params = [region] if region else []
expected = validate(db,table,region)
query = f"SELECT {COLS} FROM {table}"+where+" ORDER BY osm_type, osm_id"
pq = snapshot / (name+".parquet")
gj = snapshot / (name+".geojson")
# SQL COPY uses a locally generated, validated path, escaped as a literal.
dest = str(pq).replace("'","''")
if region:
if not re.fullmatch(r"[a-z0-9-]+",region):
raise ValueError("invalid region")
copyquery = query.replace("region=?","region='"+region+"'")
else:
copyquery = query
db.execute(f"COPY ({copyquery}) TO '{dest}' (FORMAT PARQUET, COMPRESSION ZSTD)")
n,u = db.execute("SELECT count(*),count(DISTINCT (osm_type,osm_id)) FROM read_parquet(?)",[str(pq)]).fetchone()
if n != expected or u != expected:
raise ValueError("Parquet read-back count/identity mismatch")
# Compare the full typed rows in both directions, not just count.
for left,right in [(copyquery,"SELECT "+COLS+" FROM read_parquet(?)"),
("SELECT "+COLS+" FROM read_parquet(?)",copyquery)]:
if db.execute(f"SELECT count(*) FROM (({left}) EXCEPT ALL ({right}))",[str(pq)]).fetchone()[0]:
raise ValueError("Parquet read-back data mismatch")
features = []
counts = {}
resolved_ids = set()
for kind,oid,version,stype,title,tags,geometry,state,members,source_region in db.execute(query,params).fetchall():
counts[state] = counts.get(state,0)+1
if geometry is None:
continue
fid = f"{kind}/{oid}"
resolved_ids.add(fid)
features.append({"type":"Feature","id":fid,"geometry":json.loads(geometry),
"properties":{"osm_type":kind,"osm_id":oid,"osm_version":version,
"seamark_type":stype,"name":title,"region":source_region}})
write_json(gj,{"type":"FeatureCollection","attribution":ATTR,"license":LICENSE,
"warning":SAFETY,"features":features})
readback = json.loads(gj.read_text(encoding="utf-8"))
ids = [f["id"] for f in readback["features"]]
if set(ids)!=resolved_ids or len(ids)!=len(resolved_ids) or len(ids)!=counts.get("resolved",0):
raise ValueError("GeoJSON read-back mismatch")
return {"rows":expected,"geometry_states":counts,"parquet":asset(pq,root),"geojson":asset(gj,root)}
def build(regions, snapshot_id, root, registry):
if not re.fullmatch(r"[a-zA-Z0-9][a-zA-Z0-9-]{0,79}",snapshot_id):
raise ValueError("invalid snapshot ID")
if len(set(regions)) != len(regions) or not regions or len(regions)>4:
raise ValueError("choose one to four distinct pilot regions")
if any(r not in registry or not re.fullmatch(r"[a-z0-9-]+",r) for r in regions):
raise ValueError("unknown region")
snapshot = root / "data" / "versions" / snapshot_id
snapshot.mkdir(parents=True,exist_ok=False)
manifest = {"schema":"opensea.manifest.v1","snapshot":snapshot_id,
"created_utc":datetime.now(timezone.utc).isoformat(),
"scope":"regional OSM seamark:type features only; not worldwide coverage",
"crs":"OGC:CRS84","attribution":ATTR,"licence":LICENSE,
"copyright":"https://www.openstreetmap.org/copyright","warning":SAFETY,
"regions":[]}
with tempfile.TemporaryDirectory() as tmp, duckdb.connect() as db:
db.execute(DDL)
for region in regions:
path, source = acquire(region,registry[region]["url"],Path(tmp))
ingest(db,path,region)
manifest["regions"].append({**source,**export(db,"features",region,snapshot,root,region)})
stitch(db)
manifest["union"] = export(db,"stitched","union",snapshot,root)
write_json(snapshot/"manifest.json",manifest)
pointer = root/"data"/"current.json"
staging = pointer.with_suffix(".tmp")
write_json(staging,manifest)
staging.replace(pointer)
print(json.dumps(manifest,indent=2,ensure_ascii=False))
def main():
p = argparse.ArgumentParser(description=__doc__)
p.add_argument("--region",action="append",required=True)
p.add_argument("--snapshot",required=True)
p.add_argument("--out",type=Path,required=True)
a = p.parse_args()
registry = json.loads((ROOT/"config/regions.json").read_text())["regions"]
build(a.region,a.snapshot,a.out.resolve(),registry)
if __name__=="__main__":
main()Test Marine
A test in the tests folder of Opensea that checks Build Marine, using SHA-256.
testopensea / tests/test_marine.py · lines 1–81 of 81 · Entry point · pattern test_round_trip (shared by 2 files)
- What it does
- It tests its inputs. Defines 11 functions or classes, including MarineTests, setUp, tearDown, test_ingest_and_relation, test_round_trip. Uses libraries json, sys, tempfile, unittest, pathlib. Side effects: reads or writes files; uses storage (browser storage, DuckDB or Parquet).
- Inputs & outputs
- In: GeoJSON file a.geojson; Parquet file a.parquet; DuckDB queries.
- Downstream impact
- Used directly by 1 file: Marine Workflow (opensea).
- What it achieves
- It sets up (`setUp`) and is built from the marine tests class (`MarineTests`) and the tear down helper (`tearDown`). Defines `MarineTests`, `setUp`, `tearDown` and 8 more.
- Why it matters
- Run by Marine Workflow.
- Application
- opensea · tests · test
- Uses
- Build Marine (sys.path import), json, sys, tempfile, unittest, pathlib, duckdb
- Used by
- run by Marine Workflow (workflow run)
- Produces
- MarineTests
- Defines here
- MarineTests, setUp, tearDown, test_ingest_and_relation, test_round_trip, test_region_stitch, test_conflict, test_newer_version, test_prefer_resolved, test_duplicate_identity, test_coordinate_guards
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- opensea@93a4b5c996596d10d9bf3ec99a86338cf22f2029 tests/test_marine.py:1-81 · blob ad80a4eeff073714fdf34b0cc9782ab1f6348e07 · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: output · effects: filesystem, storage · domain stage: unknown · users: none · canonical: unknown
import json
import sys
import tempfile
import unittest
from pathlib import Path
import duckdb
sys.path.insert(0,str(Path(__file__).resolve().parents[1]/"scripts"))
import build_marine as m
FIXTURE = """<?xml version="1.0" encoding="UTF-8"?>
<osm version="0.6" generator="test">
<node id="1" version="1" lat="50.7" lon="-1.3"><tag k="seamark:type" v="buoy_lateral"/></node>
<node id="2" version="1" lat="50.8" lon="-1.2"/>
<node id="3" version="1" lat="50.9" lon="-1.1"/>
<way id="4" version="2"><nd ref="2"/><nd ref="3"/><tag k="seamark:type" v="cable_submarine"/></way>
<relation id="5" version="1"><member type="way" ref="4" role="outer"/><tag k="seamark:type" v="restricted_area"/></relation>
</osm>"""
class MarineTests(unittest.TestCase):
def setUp(self):
self.db=duckdb.connect()
self.db.execute(m.DDL)
self.tmp=tempfile.TemporaryDirectory()
self.root=Path(self.tmp.name)
self.source=self.root/"test.osm"
self.source.write_text(FIXTURE)
m.ingest(self.db,self.source,"a")
def tearDown(self):
self.db.close()
self.tmp.cleanup()
def test_ingest_and_relation(self):
self.assertEqual(m.validate(self.db,"features","a"),3)
self.assertEqual(self.db.execute("SELECT geometry_state FROM features WHERE osm_type='relation'").fetchone()[0],"relation_unresolved")
self.assertEqual(self.db.execute("SELECT count(*) FROM features WHERE geometry_json IS NOT NULL").fetchone()[0],2)
def test_round_trip(self):
snap=self.root/"data"/"versions"/"test"
snap.mkdir(parents=True)
receipt=m.export(self.db,"features","a",snap,self.root,"a")
self.assertEqual(receipt["rows"],3)
self.assertEqual(len(json.loads((snap/"a.geojson").read_text())["features"]),2)
self.assertEqual(receipt["parquet"]["sha256"],m.checksum(snap/"a.parquet"))
def test_region_stitch(self):
m.ingest(self.db,self.source,"b")
self.assertEqual(m.stitch(self.db),3)
def test_conflict(self):
m.ingest(self.db,self.source,"b")
self.db.execute("UPDATE features SET tags_json='{}' WHERE region='b' AND osm_id=1")
with self.assertRaisesRegex(ValueError,"source conflict"):
m.stitch(self.db)
def test_newer_version(self):
m.ingest(self.db,self.source,"b")
self.db.execute("UPDATE features SET osm_version=2 WHERE region='b' AND osm_id=1")
m.stitch(self.db)
self.assertEqual(self.db.execute("SELECT osm_version FROM stitched WHERE osm_id=1").fetchone()[0],2)
def test_prefer_resolved(self):
m.ingest(self.db,self.source,"b")
self.db.execute("UPDATE features SET geometry_json=NULL,geometry_state='missing_coordinates' WHERE region='a' AND osm_id=4")
m.stitch(self.db)
self.assertEqual(self.db.execute("SELECT region FROM stitched WHERE osm_id=4").fetchone()[0],"b")
def test_duplicate_identity(self):
with self.assertRaisesRegex(ValueError,"duplicate"):
m.ingest(self.db,self.source,"a")
def test_coordinate_guards(self):
self.assertIsNone(m.point(float("nan"),0))
self.assertIsNone(m.point(181,0))
self.assertEqual(m.line_geometry([[179,0],[-179,0]])[1],"antimeridian_unresolved")
self.assertEqual(m.line_geometry([[0,0],None])[1],"missing_coordinates")
self.assertEqual(m.line_geometry([[0,0],[0,0]])[1],"degenerate_line")
if __name__=="__main__":
unittest.main()Nightly Workflow
A GitHub Actions workflow in Particle Physics Drawing Engine. Runs on push, on a schedule and by hand.
automationparticle-physics-drawing-engine / .github/workflows/nightly.yml · lines 1–89 of 89 · Entry point
- What it does
- It runs automated jobs on GitHub Actions. Side effects: starts processes.
- Inputs & outputs
- Out: commits pushed to the repository.
- Downstream impact
- It is itself an entry point (workflow); no other file was found loading it.
- What it achieves
- Runs Spiral vs Stack (`tools/spiral_vs_stack.py`), Underground (`tools/underground.py`) and Particles (`tools/particles.py`).
- Why it matters
- No other file in the estate was found to import it; it is an entry point.
- Application
- particle-physics-drawing-engine · .github/workflows · workflow
- Uses
- Spiral vs Stack (workflow run), Underground (workflow run), Particles (workflow run), Scope Check (workflow run)
- Used by
- none found
- Produces
- none declared
- Defines here
- nightly
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- particle-physics-drawing-engine@d3d28cc760761dab210dc3850577ee73c23fe8c5 .github/workflows/nightly.yml:1-89 · blob dd4a804dfbbde5c5c09d9c20a7286466666e37f4 · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: unknown · effects: process · domain stage: unknown · users: none · canonical: unknown
name: nightly
# Progress without a model: every three hours GitHub draws B1 (spiral vs stack) and B2 (the Underground
# from a typed command), commits the pictures and the measured facts into results/, and the MSI swarm,
# when dispatched, does the big runs into E:\particles-runs and mirrors them.
on:
push:
paths: [".github/workflows/nightly.yml", "tools/**"]
schedule:
- cron: "17 */3 * * *"
workflow_dispatch:
inputs:
msi:
description: "also run the big layer sweep on the MSI swarm (E: drive)"
type: boolean
default: false
layers:
description: "largest layer count for the MSI sweep (2^18 particles each)"
default: "64"
permissions:
contents: write
concurrency:
group: nightly
cancel-in-progress: false
jobs:
github:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: B1 spiral vs stack, 4 layers of 2^18
run: python tools/spiral_vs_stack.py --layers 4 --out out/b1
- name: B2 the Underground from a typed command (TfL open data)
run: python tools/underground.py --out out/b2
- name: T2 and T4 again, so the record repeats itself
run: |
python tools/particles.py exactness
python tools/particles.py layer --layer 1 --out out/layer
python tools/particles.py dna out/layer/layer-1.json
- name: the scope drives the loop
run: python tools/scope_check.py
- name: commit the results
run: |
stamp=$(date -u +%Y%m%dT%H%MZ)
mkdir -p results/$stamp results/latest
cp out/b1/*.json out/b2/underground.json out/layer/layer-1.json results/$stamp/
cp out/b1/spiral-vs-stack.png out/b2/underground.png results/latest/
cp results/SCOPE-STATUS.md results/latest/ # overwritten in place; big data stays off GitHub
{
echo "# Latest results: $stamp (GitHub-hosted, ubuntu-latest)"
echo
echo ""
echo
echo ""
echo
echo '```'; cat out/b1/spiral-vs-stack.json; echo; cat out/b2/underground.json; echo '```'
} > results/LATEST.md
git config user.name "particles-nightly"
git config user.email "actions@users.noreply.github.com"
git add results
git commit -m "results $stamp: B1 spiral vs stack, B2 underground, T2, T4" || echo "nothing new"
git pull --rebase origin main || true
git push
msi-sweep:
if: ${{ inputs.msi }}
strategy:
fail-fast: false
matrix:
layers: [1, 4, 16, 64]
runs-on: [self-hosted, msi, gpu]
steps:
- uses: actions/checkout@v4
- name: "big run on the MSI, written to drive E"
shell: pwsh
run: |
$out = "E:\particles-runs\$(Get-Date -Format yyyyMMddTHHmm)-layers-${{ matrix.layers }}"
if (${{ matrix.layers }} -gt ${{ inputs.layers }}) { "skipped: above the requested size"; exit 0 }
python tools/spiral_vs_stack.py --layers ${{ matrix.layers }} --out $out
python tools/particles.py layer --layer ${{ matrix.layers }} --out $out
python tools/particles.py dna "$out\layer-${{ matrix.layers }}.json"
Get-ChildItem $out | Select-Object Name, Length
- name: "mirror the repository results to drive E"
shell: pwsh
run: robocopy results "E:\particles-runs\results-mirror" /E /NFL /NDL /NJH /NJS; if ($LASTEXITCODE -le 7) { exit 0 }Particles Workflow
A GitHub Actions workflow in Particle Physics Drawing Engine. Runs on push and by hand.
automationparticle-physics-drawing-engine / .github/workflows/particles.yml · lines 1–59 of 59 · Entry point
- What it does
- It runs automated jobs on GitHub Actions. Side effects: starts processes.
- Why it exists in the grid workflow
- README: "`.github/workflows/particles.yml` runs on GitHub-hosted machines on every push to `tools/` and on demand: exactness, a generated layer on Ubuntu and on Windows, and the cross-machine DNA test."
- Downstream impact
- It is itself an entry point (workflow); no other file was found loading it.
- What it achieves
- Runs Particles (`tools/particles.py`).
- Why it matters
- No other file in the estate was found to import it; it is an entry point.
- Application
- particle-physics-drawing-engine · .github/workflows · workflow
- Uses
- Particles (workflow run)
- Used by
- none found
- Produces
- none declared
- Defines here
- particles
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- particle-physics-drawing-engine@d3d28cc760761dab210dc3850577ee73c23fe8c5 .github/workflows/particles.yml:1-59 · blob 08358c5fe9eef0b761b8adb8c18bc36ee318dacf · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: unknown · effects: process · domain stage: unknown · users: none · canonical: unknown
name: particles
# GitHub-hosted runners (free for a public repository). No self-hosted runner and no model is involved.
on:
push:
paths: ["tools/**", ".github/workflows/particles.yml"]
workflow_dispatch:
inputs:
msi:
description: "also run on the MSI self-hosted runner (register one for this repo first)"
type: boolean
default: false
jobs:
# The workstation's own compute, used when credits are scarce. Its manifest is reconciled
# against the two GitHub-hosted machines below: three ledgers, one hash, or the run fails.
msi:
if: ${{ inputs.msi }}
runs-on: [self-hosted, msi, gpu]
steps:
- uses: actions/checkout@v4
- run: python tools/particles.py exactness
- run: python tools/particles.py layer --layer 1 --recipe grid-feeder --seed 2026-09-18 --out out
- run: python tools/particles.py dna out/layer-1.json
- uses: actions/upload-artifact@v4
with:
name: layer-msi
path: out
generate:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: T2 exactness of the angle law
run: python tools/particles.py exactness
- name: generate layer 1 (nothing stored but the manifest)
run: python tools/particles.py layer --layer 1 --recipe grid-feeder --seed 2026-09-18 --out out
- name: DNA test on the same machine
run: python tools/particles.py dna out/layer-1.json
- uses: actions/upload-artifact@v4
with:
name: layer-${{ matrix.os }}
path: out
dna-across-machines:
needs: generate
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: got
- name: T4 reconciliation - every machine that generated the layer must hold the same hash
run: python tools/particles.py compare got/layer-*/layer-1.json