Skip to content

[FEATURE] Expose API corresponding to cocoindex setup and cocoindex drop #639

@badmonster0

Description

@badmonster0

Currently cocoindex setup and cocoindex drop is the only way to apply setup changes / drop setup for flows. There's a bunch of related functions under cocoindex/setup.py which CLI calls, but they have the following limitations:

  • After applying setup change, data processing has to happen in a separate process. This is because AllSetupState and FlowContext needs to be rebuilt after setup change, and they're only built once and maintained as global in-process states now.

  • setup work for all loaded flows, but don't work for a single flow. This was a simplification, given there're resource shared among different flows (i.e. the CocoIndex Metadata Table). This makes more sense for a CLI interface (which usually involves human interaction), but seems cumbersome if we expose an API over that.

Ideally, we may want to expose API to be used in this way:

flow1.setup()  # Apply setup updates for flow1. It's noop if already up-to-date.
flow1.drop()   # Drop the setup for flow1

# We also support doing it for all
cocoindex.setup_all()
cocoindex.drop_all()

and users should be able to run update immediately after setup within the same process:

flow1.setup()
flow1.update()

❤️ Contributors, please refer to 📙Contributing Guide.
Unless the PR can be sent immediately (e.g. just a few lines of code), we recommend you to leave a comment on the issue like I'm working on it or Can I work on this issue? to avoid duplicating work. Our Discord server is always open and friendly.

Metadata

Metadata

Assignees

Labels

Projects

Status

🚀 In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions