Deployment Scenarios

The pipeline you write for one computer is the pipeline that runs across several. What changes is the process around it: its residency, declared before the first node is built, decides which nodes this process builds and what the pipeline wraps around them. One serialized pipeline describes the whole system, and every process reads all of it.

Residency

Three values, set in the script or on the command line:

import gpype as gp

gp.LaunchConfig.configure(residency="edge", endpoint="wss://server:8765")
# ... then build and start the pipeline as usual
python my_pipeline.py --residency server --endpoint wss://server:8765
python my_pipeline.py --residency edge --endpoint wss://server:8765

gp.LaunchConfig.parse_args() reads those flags, so one file serves every role; Season 8, Episode 1 is such a file. edge and server require an endpoint.

Residency

Owns

Builds

standalone

everything

Every node as written, in one process, with no transport. The default.

edge

the devices and the screen

Its sources, each with a Link that sends to the server; its sinks and widgets, each fed by a Link from the server, so a file is written where its edge runs.

server

the processing

The receiving side of each source’s Link, the processing nodes, and the sending side of each sink’s and widget’s Link. No device is opened, no file is read, and MainApp builds no window.

Which edge runs a node

Every source, sink and widget takes an optional edge_id, and an edge process is told which edge it is with --edge-id, with GPYPE_EDGE_ID in its environment, or with configure(edge_id=...). What each process builds for a node:

Process

node names no edge

node names this edge

node names another edge

standalone

the node

the node

the node

edge

the node and its Link

the node and its Link

a placeholder, no Link

server

the far side of the Link

the same

the same

A node that names no edge runs on every edge, so two edges both open its source and both send its stream; the server takes the stream from the first and warns about the other. A pipeline run by several edges should therefore assign every source. Season 8, Episode 2 covers how a serialized pipeline travels between processes, and which modules a process may load from it.

The data socket

The endpoint names the server’s data socket, ws:// or wss://. It carries every sample and the pipeline itself, so the transport policy (gpype/_transport.py, kept readable on purpose) refuses plaintext to any host but this machine unless --insecure says the network is trusted. With wss the server presents --certfile, and --keyfile when the key is a separate file; an edge trusts --ca-file in addition to the system store. --bind loopback keeps a server’s socket off the network altogether, for an edge on the same machine.

An edge may present a token, read from GPYPE_DATA_TOKEN rather than a flag, because a process list shows argv; the server names what it accepts with configure(data_tokens=...), by capability. --save-as and --load-from are launch settings too: Record and Replay.

A headless server

pip install gpype installs no Qt (The Layered Install and Lazy Imports), and on a server no source opens a device or a file, so a server can read a serialized pipeline that names hardware it does not have. A server is a deployment, and its start() refuses without a g.Pype Runtime licence; where a licence cannot be verified on Linux or macOS, as in some containers, the message says what to set, such as GTEC_LICENSE_MACHINE_ID. Where the home directory cannot be written, gp.Settings falls back to the temporary directory, or to memory, and warns once.

Beyond two processes

Two more places run the same pipeline, with the same residencies; the tooling for the second comes in a later release. A g.Pype Runtime hosts server pipelines for applications that are not Python: a web or phone application starts a pipeline and reads it through a client library, over the protocols an edge uses, and holds the frontend itself. In a browser, the server half of a pipeline runs on Pyodide in a Web Worker, with the page as its edge, holding the sources and the scopes. The runtime comes with its own documentation, and the browser route will; the pipeline is this manual’s.