torchx-nightly 2025.2.13__py3-none-any.whl → 2025.2.15__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of torchx-nightly might be problematic. Click here for more details.

torchx/cli/cmd_run.py CHANGED
@@ -21,6 +21,7 @@ from typing import Dict, List, Optional, Tuple
21
21
  import torchx.specs as specs
22
22
  from torchx.cli.argparse_util import ArgOnceAction, torchxconfig_run
23
23
  from torchx.cli.cmd_base import SubCommand
24
+ from torchx.cli.cmd_log import get_logs
24
25
  from torchx.runner import config, get_runner, Runner
25
26
  from torchx.runner.config import load_sections
26
27
  from torchx.schedulers import get_default_scheduler_name, get_scheduler_factories
@@ -186,6 +187,12 @@ class CmdRun(SubCommand):
186
187
  help="optional parent run ID that this run belongs to."
187
188
  " It can be used to group runs for experiment tracking purposes",
188
189
  )
190
+ subparser.add_argument(
191
+ "--tee_logs",
192
+ action="store_true",
193
+ default=False,
194
+ help="Add additional prefix to log lines to indicate which replica is printing the log",
195
+ )
189
196
  subparser.add_argument(
190
197
  "component_name_and_args",
191
198
  nargs=argparse.REMAINDER,
@@ -237,14 +244,18 @@ class CmdRun(SubCommand):
237
244
  print(app_handle)
238
245
 
239
246
  if args.scheduler.startswith("local"):
240
- self._wait_and_exit(runner, app_handle, log=True)
247
+ self._wait_and_exit(
248
+ runner, app_handle, log=True, tee_logs=args.tee_logs
249
+ )
241
250
  else:
242
251
  logger.info(f"Launched app: {app_handle}")
243
252
  app_status = runner.status(app_handle)
244
253
  if app_status:
245
254
  logger.info(app_status.format())
246
255
  if args.wait or args.log:
247
- self._wait_and_exit(runner, app_handle, log=args.log)
256
+ self._wait_and_exit(
257
+ runner, app_handle, log=args.log, tee_logs=args.tee_logs
258
+ )
248
259
 
249
260
  except (ComponentValidationException, ComponentNotFoundException) as e:
250
261
  error_msg = f"\nFailed to run component `{component}` got errors: \n {e}"
@@ -267,10 +278,16 @@ class CmdRun(SubCommand):
267
278
  with get_runner(component_defaults=component_defaults) as runner:
268
279
  self._run(runner, args)
269
280
 
270
- def _wait_and_exit(self, runner: Runner, app_handle: str, log: bool) -> None:
281
+ def _wait_and_exit(
282
+ self, runner: Runner, app_handle: str, log: bool, tee_logs: bool = False
283
+ ) -> None:
271
284
  logger.info("Waiting for the app to finish...")
272
285
 
273
- log_thread = self._start_log_thread(runner, app_handle) if log else None
286
+ log_thread = (
287
+ self._start_log_thread(runner, app_handle, tee_logs_enabled=tee_logs)
288
+ if log
289
+ else None
290
+ )
274
291
 
275
292
  status = runner.wait(app_handle, wait_interval=1)
276
293
  if not status:
@@ -287,15 +304,30 @@ class CmdRun(SubCommand):
287
304
  else:
288
305
  logger.debug(status)
289
306
 
290
- def _start_log_thread(self, runner: Runner, app_handle: str) -> threading.Thread:
291
- thread = tee_logs(
292
- dst=sys.stderr,
293
- app_handle=app_handle,
294
- regex=None,
295
- runner=runner,
296
- should_tail=True,
297
- streams=None,
298
- colorize=not sys.stderr.closed and sys.stderr.isatty(),
299
- )
307
+ def _start_log_thread(
308
+ self, runner: Runner, app_handle: str, tee_logs_enabled: bool = False
309
+ ) -> threading.Thread:
310
+ if tee_logs_enabled:
311
+ thread = tee_logs(
312
+ dst=sys.stderr,
313
+ app_handle=app_handle,
314
+ regex=None,
315
+ runner=runner,
316
+ should_tail=True,
317
+ streams=None,
318
+ colorize=not sys.stderr.closed and sys.stderr.isatty(),
319
+ )
320
+ else:
321
+ thread = threading.Thread(
322
+ target=get_logs,
323
+ kwargs={
324
+ "file": sys.stderr,
325
+ "runner": runner,
326
+ "identifier": app_handle,
327
+ "regex": None,
328
+ "should_tail": True,
329
+ },
330
+ )
331
+ thread.daemon = True
300
332
  thread.start()
301
333
  return thread
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: torchx-nightly
3
- Version: 2025.2.13
3
+ Version: 2025.2.15
4
4
  Summary: TorchX SDK and Components
5
5
  Home-page: https://github.com/pytorch/torchx
6
6
  Author: TorchX Devs
@@ -16,7 +16,7 @@ torchx/cli/cmd_configure.py,sha256=1kTv0qbsbV44So74plAySwWu56pQrqjhfW_kbfdC3Rw,1
16
16
  torchx/cli/cmd_describe.py,sha256=E5disbHoKTsqYKp2s3DaFW9GDLCCOgdOc3pQoHKoyCs,1283
17
17
  torchx/cli/cmd_list.py,sha256=BVqHEW2oTEJ3GqcFK7c1K-i2R-DUjaXQ-WBr0meeIGM,1429
18
18
  torchx/cli/cmd_log.py,sha256=v-EZYUDOcG95rEgTnrsmPJMUyxM9Mk8YFAJtUxtgViE,5475
19
- torchx/cli/cmd_run.py,sha256=OYAp0Rp_YxdS8FLrRxoWnYX24VIsNXaGiUHAyisEXYI,11185
19
+ torchx/cli/cmd_run.py,sha256=4M1JJc7YmEa5T_2OFakCwCwiP0Ibpy-3zcLp1arrj9w,12203
20
20
  torchx/cli/cmd_runopts.py,sha256=NWZiP8XpQjfTDJgays2c6MgL_8wxFoeDge6NstaZdKk,1302
21
21
  torchx/cli/cmd_status.py,sha256=ubtmCp4PylrIh_kC3ZJ5QJm7lzXRt_aRPmY7j-sZu_0,1836
22
22
  torchx/cli/cmd_tracker.py,sha256=RfLxE4Cq1wfk7k051RtZ8RPJp0pEKSCa3KmTeRs3LF8,5218
@@ -115,9 +115,9 @@ torchx/workspace/__init__.py,sha256=FqN8AN4VhR1C_SBY10MggQvNZmyanbbuPuE-JCjkyUY,
115
115
  torchx/workspace/api.py,sha256=PtDkGTC5lX03pRoYpuMz2KCmM1ZOycRP1UknqvNb97Y,6341
116
116
  torchx/workspace/dir_workspace.py,sha256=npNW_IjUZm_yS5r-8hrRkH46ndDd9a_eApT64m1S1T4,2268
117
117
  torchx/workspace/docker_workspace.py,sha256=PFu2KQNVC-0p2aKJ-W_BKA9ZOmXdCY2ABEkCExp3udQ,10269
118
- torchx_nightly-2025.2.13.dist-info/LICENSE,sha256=WVHfXhFC0Ia8LTKt_nJVYobdqTJVg_4J3Crrfm2A8KQ,1721
119
- torchx_nightly-2025.2.13.dist-info/METADATA,sha256=fTOjnDkhvUFdkZnoyCUTTZeMpbft6_-kMzPba8n5Ntk,6169
120
- torchx_nightly-2025.2.13.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
121
- torchx_nightly-2025.2.13.dist-info/entry_points.txt,sha256=T328AMXeKI3JZnnxfkEew2ZcMN1oQDtkXjMz7lkV-P4,169
122
- torchx_nightly-2025.2.13.dist-info/top_level.txt,sha256=pxew3bc2gsiViS0zADs0jb6kC5v8o_Yy_85fhHj_J1A,7
123
- torchx_nightly-2025.2.13.dist-info/RECORD,,
118
+ torchx_nightly-2025.2.15.dist-info/LICENSE,sha256=WVHfXhFC0Ia8LTKt_nJVYobdqTJVg_4J3Crrfm2A8KQ,1721
119
+ torchx_nightly-2025.2.15.dist-info/METADATA,sha256=4FcpFnncK6KMjD0EfvKhG5w9js7YUF_5Yk_RjrDH9PQ,6169
120
+ torchx_nightly-2025.2.15.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
121
+ torchx_nightly-2025.2.15.dist-info/entry_points.txt,sha256=T328AMXeKI3JZnnxfkEew2ZcMN1oQDtkXjMz7lkV-P4,169
122
+ torchx_nightly-2025.2.15.dist-info/top_level.txt,sha256=pxew3bc2gsiViS0zADs0jb6kC5v8o_Yy_85fhHj_J1A,7
123
+ torchx_nightly-2025.2.15.dist-info/RECORD,,