Skip to content

Commit a5964e4

Browse files
committed
renamed log_handlers_builder to handler_factory
1 parent 84fcb4e commit a5964e4

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "torchrunx"
7-
version = "0.2.1"
7+
version = "0.2.2"
88
authors = [
99
{name = "Apoorv Khandelwal", email = "[email protected]"},
1010
{name = "Peter Curtin", email = "[email protected]"},

src/torchrunx/launcher.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def run( # noqa: C901, PLR0912
6464
func: Callable,
6565
func_args: tuple[Any] | None = None,
6666
func_kwargs: dict[str, Any] | None = None,
67-
log_handlers_builder: Callable[[], list[Handler]] | Literal["auto"] | None = "auto",
67+
handler_factory: Callable[[], list[Handler]] | Literal["auto"] | None = "auto",
6868
) -> LaunchResult:
6969
"""Run a function using the :mod:`torchrunx.Launcher` configuration."""
7070
if not dist.is_available():
@@ -88,7 +88,7 @@ def run( # noqa: C901, PLR0912
8888
# Start logging server (recieves LogRecords from agents/workers)
8989

9090
logging_server_args = LoggingServerArgs(
91-
log_handlers_builder=log_handlers_builder,
91+
handler_factory=handler_factory,
9292
logging_hostname=launcher_hostname,
9393
logging_port=logging_port,
9494
hostnames=hostnames,
@@ -214,7 +214,7 @@ def launch(
214214
),
215215
extra_env_vars: tuple[str, ...] = (),
216216
env_file: str | os.PathLike | None = None,
217-
log_handlers_builder: Callable[[], list[Handler]] | Literal["auto"] | None = "auto",
217+
handler_factory: Callable[[], list[Handler]] | Literal["auto"] | None = "auto",
218218
) -> LaunchResult:
219219
"""Launch a distributed PyTorch function on the specified nodes.
220220
@@ -235,7 +235,7 @@ def launch(
235235
Supports bash pattern matching syntax.
236236
extra_env_vars: Additional user-specified environment variables to copy.
237237
env_file: Path to a file (e.g., `.env`) with additional environment variables to copy.
238-
log_handlers_builder: Function to build handlers for managing agent and worker logs.
238+
handler_factory: Function to build logging handlers that process agent and worker logs.
239239
Defaults to an automatic basic logging scheme.
240240
241241
Raises:
@@ -257,7 +257,7 @@ def launch(
257257
func=func,
258258
func_args=func_args,
259259
func_kwargs=func_kwargs,
260-
log_handlers_builder=log_handlers_builder,
260+
handler_factory=handler_factory,
261261
)
262262

263263

src/torchrunx/utils/logging.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ def shutdown(self) -> None:
187187
class LoggingServerArgs:
188188
"""Arguments for starting a :class:`_LogRecordSocketReceiver`."""
189189

190-
log_handlers_builder: Callable[[], list[Handler]] | Literal["auto"] | None
190+
handler_factory: Callable[[], list[Handler]] | Literal["auto"] | None
191191
logging_hostname: str
192192
logging_port: int
193193
hostnames: list[str]
@@ -213,17 +213,17 @@ def start_logging_server(
213213
args = LoggingServerArgs.deserialize(serialized_args)
214214

215215
log_handlers = []
216-
if args.log_handlers_builder is None:
216+
if args.handler_factory is None:
217217
log_handlers = []
218-
elif args.log_handlers_builder == "auto":
218+
elif args.handler_factory == "auto":
219219
log_handlers = default_handlers(
220220
hostnames=args.hostnames,
221221
workers_per_host=args.workers_per_host,
222222
log_dir=args.log_dir,
223223
log_level=args.log_level,
224224
)
225-
elif isinstance(args.log_handlers_builder, Callable):
226-
log_handlers = args.log_handlers_builder()
225+
elif isinstance(args.handler_factory, Callable):
226+
log_handlers = args.handler_factory()
227227

228228
log_receiver = _LogRecordSocketReceiver(
229229
host=args.logging_hostname,

0 commit comments

Comments
 (0)