diff --git a/README.md b/README.md index f5f2861..72c6aa4 100644 --- a/README.md +++ b/README.md @@ -1,37 +1,36 @@ -Coggo -===== +# Cog Runtime Alt-core [Cog] runtime implementation. The original [Cog] seeks to be a great developer tool and also an arguably great -production runtime. Coggo is focused on being a fantastic production runtime _only_. +production runtime. Cog runtime is focused on being a fantastic production runtime _only_. -How is Coggo formed? +How is `cog-runtime` formed? ```mermaid sequenceDiagram - r8->>coggo-server: HTTP - activate coggo-server - coggo-server->>cog.internal.file_runner: File write - activate cog.internal.file_runner - cog.internal.file_runner-->>coggo-server: SIGUSR1 - cog.internal.file_runner-->>coggo-server: SIGHUP - coggo-server->>cog.internal.file_runner: File read - deactivate cog.internal.file_runner - coggo-server->>r8: HTTP - deactivate coggo-server + r8->>cog-server: HTTP + activate cog-server + cog-server->>coglet: File write + activate coglet + coglet-->>cog-server: SIGUSR1 + coglet-->>cog-server: SIGHUP + cog-server->>coglet: File read + deactivate coglet + cog-server->>r8: HTTP + deactivate cog-server ``` This sequence is simplified, but the rough idea is that the Replicate platform (`r8`) -depends on `coggo-server` to provide an HTTP API in front of a `cog.internal.file_runner` +depends on `cog-server` to provide an HTTP API in front of a `coglet` that communicates via files and signals. -## `coggo-server` +## `cog-server` Go-based HTTP server that known how to spawn and communicate with -`cog.internal.file_runner`. +`coglet`. -## `cog.internal.file_runner` +## `coglet` Python-based model runner with zero dependencies outside of the standard library. The same in-process API provided by [Cog] is avaaliable, e.g.: @@ -47,7 +46,7 @@ class MyPredictor(BasePredictor): In addition to simple cases like the above, the runner is async by default and supports continuous batching. -Communication with the `coggo-server` parent process is managed via input and output files +Communication with the `cog-server` parent process is managed via input and output files and the following signals: - `SIGUSR1` model is ready diff --git a/TODO.md b/TODO.md index c1617f1..a2c2100 100644 --- a/TODO.md +++ b/TODO.md @@ -1,6 +1,6 @@ -* coggo-server: Output file encoding and upload -* coggo-server: Webhook interval -* coggo-server: E2E tests -* coggo-server: Publish go binary -* python: Publish python source tree +* cog-server: Output file encoding and upload +* cog-server: Webhook interval +* cog-server: E2E tests +* cog-server: Publish go binary +* coglet: Publish python source tree * Install both in monobase build.sh diff --git a/cmd/coggo-server/main.go b/cmd/cog-server/main.go similarity index 91% rename from cmd/coggo-server/main.go rename to cmd/cog-server/main.go index d93cc5f..b5d649e 100644 --- a/cmd/coggo-server/main.go +++ b/cmd/cog-server/main.go @@ -17,11 +17,11 @@ import ( "github.com/replicate/go/version" _ "go.uber.org/automaxprocs" - "github.com/replicate/coggo/internal/server" - "github.com/replicate/coggo/internal/util" + "github.com/replicate/cog-runtime/internal/server" + "github.com/replicate/cog-runtime/internal/util" ) -var logger = logging.New("coggo-server") +var logger = logging.New("cog-server") type Config struct { Host string `ff:"long: host, default: 0.0.0.0, usage: HTTP server host"` @@ -43,12 +43,12 @@ func main() { log := logger.Sugar() var cfg Config - flags := ff.NewFlagSet("coggo-server") + flags := ff.NewFlagSet("cog-server") must.Do(flags.AddStruct(&cfg)) cmd := &ff.Command{ - Name: "coggo-server", - Usage: "coggo-server [FLAGS]", + Name: "cog-server", + Usage: "cog-server [FLAGS]", Flags: flags, Exec: func(ctx context.Context, args []string) error { if err := cfg.Validate(); err != nil { @@ -67,7 +67,7 @@ func main() { } workingDir := cfg.WorkingDir if workingDir == "" { - workingDir = must.Get(os.MkdirTemp("", "coggo-server-")) + workingDir = must.Get(os.MkdirTemp("", "cog-server-")) } log.Infow("configuration", "working-dir", workingDir, "module-name", moduleName, "class-name", className) diff --git a/go.mod b/go.mod index ba245da..2a9c187 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/replicate/coggo +module github.com/replicate/cog-runtime go 1.23.3 diff --git a/internal/server/runner.go b/internal/server/runner.go index 8ed2485..36ec880 100644 --- a/internal/server/runner.go +++ b/internal/server/runner.go @@ -18,7 +18,7 @@ import ( "github.com/replicate/go/must" - "github.com/replicate/coggo/internal/util" + "github.com/replicate/cog-runtime/internal/util" ) var LOG_REGEX = regexp.MustCompile(`^\[pid=(?P[^\\]+)] (?P.*)$`) diff --git a/script/coggo.sh b/script/cog-server.sh similarity index 93% rename from script/coggo.sh rename to script/cog-server.sh index b7b6c84..bd8a79b 100755 --- a/script/coggo.sh +++ b/script/cog-server.sh @@ -18,7 +18,7 @@ export PATH="$base_dir/python/.venv/bin:$PATH" export PYTHONPATH="$base_dir/python" rm -rf tmp mkdir -p tmp -go run cmd/coggo-server/main.go \ +go run cmd/cog-server/main.go \ --working-dir tmp \ --module-name "tests.runners.$module" \ --class-name Predictor \