Skip to content

Commit 22536d7

Browse files
authored
Remove cog migrate command and dead code (#2667)
The cog migrate command was a hidden command used to migrate projects to fast boot compatibility. This removes: - pkg/cli/migrate.go - CLI command definition - pkg/migrate/ - entire migration package (7 files) - pkg/coglog/migrate_log_context.go - migration telemetry context - python/cog/command/migrate_v1_v1fast.py - Python AST transformer - Integration tests for migration (3 files) - Documentation for cog migrate in docs/cli.md and docs/llms.txt - Migration telemetry methods from pkg/coglog/client.go
1 parent 0447eb1 commit 22536d7

File tree

17 files changed

+0
-1028
lines changed

17 files changed

+0
-1028
lines changed

docs/cli.md

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -285,31 +285,6 @@ cog login
285285
echo $REPLICATE_API_TOKEN | cog login --token-stdin
286286
```
287287

288-
### cog migrate
289-
290-
Run a migration to update project to newer Cog version.
291-
292-
```
293-
cog migrate [options]
294-
```
295-
296-
**Flags:**
297-
298-
| Flag | Type | Default | Description |
299-
|------|------|---------|-------------|
300-
| `-y` | bool | false | Disable interaction and automatically accept changes |
301-
| `-f` | string | cog.yaml | The name of the config file |
302-
303-
**Examples:**
304-
305-
```bash
306-
# Run migration interactively
307-
cog migrate
308-
309-
# Run migration automatically accepting all changes
310-
cog migrate -y
311-
```
312-
313288
### cog debug
314289

315290
Generate a Dockerfile from cog configuration.

docs/llms.txt

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -495,31 +495,6 @@ cog login
495495
echo $REPLICATE_API_TOKEN | cog login --token-stdin
496496
```
497497

498-
### cog migrate
499-
500-
Run a migration to update project to newer Cog version.
501-
502-
```
503-
cog migrate [options]
504-
```
505-
506-
**Flags:**
507-
508-
| Flag | Type | Default | Description |
509-
|------|------|---------|-------------|
510-
| `-y` | bool | false | Disable interaction and automatically accept changes |
511-
| `-f` | string | cog.yaml | The name of the config file |
512-
513-
**Examples:**
514-
515-
```bash
516-
# Run migration interactively
517-
cog migrate
518-
519-
# Run migration automatically accepting all changes
520-
cog migrate -y
521-
```
522-
523498
### cog debug
524499

525500
Generate a Dockerfile from cog configuration.

integration-tests/tests/migration.txtar

Lines changed: 0 additions & 20 deletions
This file was deleted.

integration-tests/tests/migration_gpu.txtar

Lines changed: 0 additions & 21 deletions
This file was deleted.

integration-tests/tests/migration_no_python_changes.txtar

Lines changed: 0 additions & 26 deletions
This file was deleted.

pkg/cli/migrate.go

Lines changed: 0 additions & 65 deletions
This file was deleted.

pkg/cli/root.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ https://github.com/replicate/cog`,
4545
newRunCommand(),
4646
newServeCommand(),
4747
newTrainCommand(),
48-
newMigrateCommand(),
4948
newPullCommand(),
5049
)
5150

pkg/coglog/client.go

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,6 @@ type pushLog struct {
3535
LocalImage bool `json:"local_image"`
3636
}
3737

38-
type migrateLog struct {
39-
DurationMs float32 `json:"length_ms"`
40-
BuildError *string `json:"error"`
41-
Accept bool `json:"accept"`
42-
PythonPackageStatus string `json:"python_package_status"`
43-
RunStatus string `json:"run_status"`
44-
PythonPredictStatus string `json:"python_predict_status"`
45-
PythonTrainStatus string `json:"python_train_status"`
46-
}
47-
4838
type pullLog struct {
4939
DurationMs float32 `json:"length_ms"`
5040
BuildError *string `json:"error"`
@@ -130,42 +120,6 @@ func (c *Client) EndPush(ctx context.Context, err error, logContext PushLogConte
130120
return true
131121
}
132122

133-
func (c *Client) StartMigrate(accept bool) *MigrateLogContext {
134-
logContext := NewMigrateLogContext(accept)
135-
return logContext
136-
}
137-
138-
func (c *Client) EndMigrate(ctx context.Context, err error, logContext *MigrateLogContext) bool {
139-
var errorStr *string = nil
140-
if err != nil {
141-
errStr := err.Error()
142-
errorStr = &errStr
143-
}
144-
migrateLog := migrateLog{
145-
DurationMs: float32(time.Since(logContext.started).Milliseconds()),
146-
BuildError: errorStr,
147-
Accept: logContext.accept,
148-
PythonPackageStatus: logContext.PythonPackageStatus,
149-
RunStatus: logContext.RunStatus,
150-
PythonPredictStatus: logContext.PythonPredictStatus,
151-
PythonTrainStatus: logContext.PythonTrainStatus,
152-
}
153-
154-
jsonData, err := json.Marshal(migrateLog)
155-
if err != nil {
156-
console.Warn("Failed to marshal JSON for build log: " + err.Error())
157-
return false
158-
}
159-
160-
err = c.postLog(ctx, jsonData, "migrate")
161-
if err != nil {
162-
console.Warn(err.Error())
163-
return false
164-
}
165-
166-
return true
167-
}
168-
169123
func (c *Client) StartPull() PullLogContext {
170124
logContext := PullLogContext{
171125
started: time.Now(),

pkg/coglog/migrate_log_context.go

Lines changed: 0 additions & 28 deletions
This file was deleted.

pkg/migrate/factory.go

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)