Skip to content

Commit

Permalink
Set default image to slim, create CLI command for default container (#…
Browse files Browse the repository at this point in the history
…886)

build
  • Loading branch information
stangirala authored Sep 30, 2024
1 parent a42d770 commit 8bfac82
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 13 deletions.
21 changes: 11 additions & 10 deletions examples/readme/readme_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,17 @@ def dynamic_router(val: Sum) -> List[Union[squared, tripled]]:
return [squared]
return [tripled]

from indexify import create_client
from indexify import create_client

g = Graph(name="sequence_summer", start_node=generate_sequence, description="Simple Sequence Summer")
g.add_edge(generate_sequence, sum_all_numbers)
g.add_edge(sum_all_numbers, dynamic_router)
g.route(dynamic_router, [squared, tripled])
if __name__ == '__main__':
g = Graph(name="sequence_summer", start_node=generate_sequence, description="Simple Sequence Summer")
g.add_edge(generate_sequence, sum_all_numbers)
g.add_edge(sum_all_numbers, dynamic_router)
g.route(dynamic_router, [squared, tripled])

client = create_client()
client.register_compute_graph(g)
client = create_client()
client.register_compute_graph(g)

invocation_id = client.invoke_graph_with_object("sequence_summer", block_until_done=True, a=10)
result = client.graph_outputs("sequence_summer", invocation_id, "squared")
print(result)
invocation_id = client.invoke_graph_with_object("sequence_summer", block_until_done=True, a=10)
result = client.graph_outputs("sequence_summer", invocation_id, "squared")
print(result)
12 changes: 10 additions & 2 deletions python-sdk/indexify/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

from indexify.executor.agent import ExtractorAgent
from indexify.executor.function_worker import FunctionWorker
from indexify.functions_sdk.image import Image
from indexify.functions_sdk.image import Image, DEFAULT_IMAGE

custom_theme = Theme(
{
Expand Down Expand Up @@ -130,7 +130,6 @@ def build_image(workflow_file_path: str, func_names: List[str]):
)

found_funcs = []
graph = None
for name, obj in globals_dict.items():
for func_name in func_names:
if name == func_name:
Expand All @@ -143,6 +142,15 @@ def build_image(workflow_file_path: str, func_names: List[str]):
)


@app.command(help="Build default image for indexify")
def build_default_image():
_build_image(image=DEFAULT_IMAGE)

console.print(
Text(f"Built default indexify image", style="cyan"),
)


@app.command(help="Joins the extractors to the coordinator server")
def executor(
server_addr: str = "localhost:8900",
Expand Down
2 changes: 1 addition & 1 deletion python-sdk/indexify/functions_sdk/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def run(self, run_str):
DEFAULT_IMAGE = (
Image()
.name("indexify-executor-default")
.base_image("python:3.10.15-bullseye")
.base_image("python:3.10.15-slim-bookworm")
.tag("latest")
.run("pip install indexify")
)

0 comments on commit 8bfac82

Please sign in to comment.