Skip to content

Commit

Permalink
Rename ExtractorAgent -> Executor
Browse files Browse the repository at this point in the history
We call this component Executor now.

Testing:

make check
make test
  • Loading branch information
eabatalov committed Dec 18, 2024
1 parent 6816f8a commit 599c32b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions python-sdk/indexify/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from rich.text import Text
from rich.theme import Theme

from indexify.executor.agent import ExtractorAgent
from indexify.executor.executor import Executor
from indexify.function_executor.function_executor_service import (
FunctionExecutorService,
)
Expand Down Expand Up @@ -221,7 +221,7 @@ def executor(
shutil.rmtree(executor_cache)
Path(executor_cache).mkdir(parents=True, exist_ok=True)

agent = ExtractorAgent(
executor = Executor(
id,
server_addr=server_addr,
config_path=config_path,
Expand All @@ -232,7 +232,7 @@ def executor(
)

try:
asyncio.get_event_loop().run_until_complete(agent.run())
asyncio.get_event_loop().run_until_complete(executor.run())
except asyncio.CancelledError:
logger.info("graceful shutdown")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from .task_reporter import TaskReporter


class ExtractorAgent:
class Executor:
def __init__(
self,
executor_id: str,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
service_url,
)

from indexify.executor.agent import ExtractorAgent
from indexify.executor.executor import Executor


class TestExtractorAgent(unittest.TestCase):
Expand All @@ -28,8 +28,8 @@ class TestExtractorAgent(unittest.TestCase):
@patch("httpx.Client")
@patch("httpx.AsyncClient")
def test_tls_configuration(self, mock_async_client, mock_sync_client, mock_file):
# Create an instance of ExtractorAgent with the mock config
agent = ExtractorAgent(
# Create an instance of Executor with the mock config
executor = Executor(
executor_id="unit-test",
code_path=Path("test"),
server_addr=service_url,
Expand All @@ -53,20 +53,20 @@ def test_tls_configuration(self, mock_async_client, mock_sync_client, mock_file)
verify=ca_bundle_path,
)

# Verify TLS config in Agent
self.assertEqual(agent._server_addr, service_url)
self.assertTrue(agent._base_url.startswith("https://"))
# Verify TLS config in Executor
self.assertEqual(executor._server_addr, service_url)
self.assertTrue(executor._base_url.startswith("https://"))

def test_no_tls_configuration(self):
# Create an instance of ExtractorAgent without TLS
agent = ExtractorAgent(
# Create an instance of Executor without TLS
executor = Executor(
executor_id="unit-test",
code_path=Path("test"),
server_addr="localhost:8900",
)

# Verify the protocol is set to "http"
self.assertTrue(agent._base_url.startswith("http://"))
self.assertTrue(executor._base_url.startswith("http://"))


if __name__ == "__main__":
Expand Down

0 comments on commit 599c32b

Please sign in to comment.