Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remaining code renaming #7

Merged
merged 5 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
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
participant r8
participant server as coggo-server
participant runner as cog.internal.file_runner
participant server as cog-server
participant runner as coglet
participant predictor as Predictor
r8->>server: Boot
activate server
Expand All @@ -38,15 +37,15 @@ sequenceDiagram
```

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.:
Expand All @@ -62,7 +61,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
Expand Down
10 changes: 5 additions & 5 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -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
14 changes: 7 additions & 7 deletions cmd/coggo-server/main.go → cmd/cog-server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand All @@ -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 {
Expand All @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/replicate/coggo
module github.com/replicate/cog-runtime

go 1.23.3

Expand Down
2 changes: 1 addition & 1 deletion internal/server/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -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<pid>[^\\]+)] (?P<msg>.*)$`)
Expand Down
2 changes: 1 addition & 1 deletion script/coggo.sh → script/cog-server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down