Skip to content

Commit

Permalink
Remaining code renaming for #6
Browse files Browse the repository at this point in the history
  • Loading branch information
meatballhat committed Nov 17, 2024
1 parent 610121a commit 0ad7fa7
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 34 deletions.
37 changes: 18 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.:
Expand All @@ -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
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

0 comments on commit 0ad7fa7

Please sign in to comment.