indexify
indexify copied to clipboard
Versioning for Graphs and Functions in Python SDK
Introduce Versioning for Graphs and Functions
Issue Description
Currently, the Indexify Python SDK lacks a robust versioning system for graphs and functions. This makes it challenging to manage changes over time, track the evolution of workflows, and ensure reproducibility of results. Implementing a versioning system will significantly improve the maintainability and reliability of Indexify workflows.
Current Limitations
- In
indexify/functions_sdk/graph.py
, theGraph
class doesn't have any version information:
class Graph:
def __init__(
self, name: str, start_node: IndexifyFunction, description: Optional[str] = None
):
self.name = name
self.description = description
self.nodes: Dict[str, Union[IndexifyFunction, IndexifyRouter]] = {}
# ...
- The
indexify_function
decorator inindexify/functions_sdk/indexify_functions.py
doesn't include version information:
def indexify_function(
name: Optional[str] = None,
description: Optional[str] = "",
image: Optional[Image] = DEFAULT_IMAGE,
accumulate: Optional[Type[BaseModel]] = None,
payload_encoder: Optional[str] = "cloudpickle",
placement_constraints: List[PlacementConstraints] = [],
):
# ...
- When registering a compute graph in
indexify/remote_client.py
, there's no version handling:
def register_compute_graph(self, graph: Graph):
graph_metadata = graph.definition()
serialized_code = graph.serialize()
response = self._post(
f"namespaces/{self.namespace}/compute_graphs",
files={"code": serialized_code},
data={"compute_graph": graph_metadata.model_dump_json(exclude_none=True)},
)
# ...
Benefits of Versioning
- Reproducibility: Ensure that workflows can be reproduced exactly, even as individual functions or the overall graph structure evolves.
- Change Tracking: Easily track changes to functions and graphs over time, facilitating debugging and auditing.
- Collaboration: Enable multiple team members to work on the same workflow without conflicts.
- Rollback Capability: Quickly revert to previous versions of functions or entire graphs if issues are discovered.
- A/B Testing: Compare different versions of workflows or functions to optimize performance.
Proposed Solution
- Add version information to the
Graph
class - Modify the
indexify_function
decorator to include version information - Update the
register_compute_graph
method to handle versioning - Implement version comparison and management utilities
- Update the
LocalClient
andRemoteClient
classes to support versioning operations - Modify the
Task
class inindexify/executor/api_objects.py
to include version information: - Update all relevant tests to include version checks