Documentation
¶
Overview ¶
Package bundlev1server implements a server implementation to run bundlev1 as gRPC servers, making it accessible to the Airflow Go Workers.
This "serving" is to local process only, and is not exposed over any network
Bundle will likely be calling Serve from their main function to start the server so Airflow's go worker can connect to it.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrCoordinatorFlagsIncomplete = errors.New(
"--comm and --logs must be supplied together",
)
ErrCoordinatorFlagsIncomplete is returned by Serve when exactly one of --comm or --logs is supplied. Both flags select coordinator mode and must be set together; callers (typically main) can check for this sentinel to print usage before exiting non-zero.
var ErrFormatRequiresMetadata = errors.New(
"--format is only valid together with --airflow-metadata",
)
ErrFormatRequiresMetadata is returned by Serve when --format is supplied without --airflow-metadata, the only mode whose encoding it selects.
Functions ¶
func Serve ¶
func Serve(bundle bundlev1.BundleProvider, opts ...ServeOpt) error
Serve is the entrypoint for your bundle, and sets it up ready for Airflow's Go Worker (go-plugin) or Python supervisor (coordinator protocol) to use.
The mode is decided from CLI flags and process environment. Callers should surface the returned error so misuse (e.g. only one of --comm/--logs supplied) produces a non-zero exit:
func main() {
if err := bundlev1server.Serve(&myBundle{}); err != nil {
log.Fatal(err)
}
}
Zero or more options to configure the server may also be passed. There are no options yet; the parameter exists to allow future additions without breaking compatibility.
Types ¶
type ServeOpt ¶
type ServeOpt interface {
ApplyServeOpt(*ServerConfig) error
}
ServeOpt is an interface for defining options that can be passed to the Serve function. Each implementation modifies the ServeConfig being generated. A slice of ServeOpts then, cumulatively applied, render a full ServeConfig.
type ServerConfig ¶
type ServerConfig struct{}
ServerConfig holds settings that ServeOpt values apply before the bundle server starts. It is currently empty; it exists so options can be added later without changing Serve's signature.