Skip to content

Commit d30c6b9

Browse files
committed
Remove --executor-id Executor CLI argument
This argument is prone to operator errors like: - Creating two Executors with the same ID. - Changing function allows list between Executor restarts. To remove this class of errors and not handle them in Server code we're removing the argument.
1 parent e43ce37 commit d30c6b9

File tree

3 files changed

+3
-38
lines changed

3 files changed

+3
-38
lines changed

Diff for: indexify/src/indexify/cli/cli.py

+1-10
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,6 @@ def executor(
102102
executor_cache: Optional[str] = typer.Option(
103103
"~/.indexify/executor_cache", help="Path to the executor cache directory"
104104
),
105-
executor_id: Optional[str] = typer.Option(
106-
None, help="ID of the executor, if not provided, a random ID will be generated"
107-
),
108105
# Registred ports range ends at 49151.
109106
ports: Tuple[int, int] = typer.Option(
110107
(50000, 51000),
@@ -153,18 +150,12 @@ def executor(
153150
"At least one function must be specified when not running in development mode"
154151
)
155152

156-
if executor_id is None:
157-
executor_id = nanoid.generate()
158-
elif not re.compile(r"^[a-zA-Z0-9_-]{10,}$").match(executor_id):
159-
raise typer.BadParameter(
160-
"--executor-id should be at least 10 characters long and only include characters _-[0-9][a-z][A-Z]"
161-
)
162-
163153
kv_labels: Dict[str, str] = {}
164154
for label in labels:
165155
key, value = label.split("=")
166156
kv_labels[key] = value
167157

158+
executor_id: str = nanoid.generate()
168159
executor_version = version("indexify")
169160
logger = structlog.get_logger(module=__name__, executor_id=executor_id)
170161

Diff for: indexify/tests/cli/test_metrics.py

+1-27
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def test_cli_package(self):
4545
self.assertEqual(cli_info_sample.labels, {"package": "indexify"})
4646
self.assertEqual(cli_info_sample.value, 1.0)
4747

48-
def test_executor_id_argument_valid_characters(self):
48+
def test_executor_info(self):
4949
with ExecutorProcessContextManager(
5050
[
5151
"--dev",
@@ -54,8 +54,6 @@ def test_executor_id_argument_valid_characters(self):
5454
"60001",
5555
"--monitoring-server-port",
5656
"7001",
57-
"--executor-id",
58-
"-test_executor_id",
5957
]
6058
) as executor_a:
6159
executor_a: subprocess.Popen
@@ -68,30 +66,6 @@ def test_executor_id_argument_valid_characters(self):
6866
self.assertEqual(len(info_metric.samples), 1)
6967
info_sample: Sample = info_metric.samples[0]
7068
self.assertIn("id", info_sample.labels)
71-
self.assertEqual(info_sample.labels["id"], "-test_executor_id")
72-
73-
def test_executor_id_argument_invalid_character(self):
74-
with ExecutorProcessContextManager(
75-
[
76-
"--dev",
77-
"--ports",
78-
"60001",
79-
"60002",
80-
"--monitoring-server-port",
81-
"7002",
82-
"--executor-id",
83-
"@-test_executor_id",
84-
]
85-
) as executor_a:
86-
executor_a: subprocess.Popen
87-
print(f"Started Executor A with PID: {executor_a.pid}")
88-
try:
89-
wait_executor_startup(7002)
90-
self.fail(
91-
"Executor should not have started with the invalid executor ID."
92-
)
93-
except Exception:
94-
pass
9569

9670
def test_expected_function_executor_infos(self):
9771
graph = Graph(

0 commit comments

Comments
 (0)