torchx-nightly 2024.2.12__py3-none-any.whl → 2024.4.11__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.

Files changed (97) hide show
  1. torchx/__init__.py +2 -0
  2. torchx/apps/serve/serve.py +2 -0
  3. torchx/apps/utils/booth_main.py +2 -0
  4. torchx/apps/utils/copy_main.py +2 -0
  5. torchx/apps/utils/process_monitor.py +2 -0
  6. torchx/cli/__init__.py +2 -0
  7. torchx/cli/argparse_util.py +38 -3
  8. torchx/cli/cmd_base.py +2 -0
  9. torchx/cli/cmd_cancel.py +2 -0
  10. torchx/cli/cmd_configure.py +2 -0
  11. torchx/cli/cmd_describe.py +2 -0
  12. torchx/cli/cmd_list.py +2 -0
  13. torchx/cli/cmd_log.py +2 -0
  14. torchx/cli/cmd_run.py +5 -1
  15. torchx/cli/cmd_runopts.py +2 -0
  16. torchx/cli/cmd_status.py +2 -0
  17. torchx/cli/cmd_tracker.py +2 -0
  18. torchx/cli/colors.py +2 -0
  19. torchx/cli/main.py +2 -0
  20. torchx/components/__init__.py +2 -0
  21. torchx/components/component_test_base.py +2 -0
  22. torchx/components/dist.py +2 -0
  23. torchx/components/integration_tests/component_provider.py +2 -0
  24. torchx/components/integration_tests/integ_tests.py +2 -0
  25. torchx/components/serve.py +2 -0
  26. torchx/components/structured_arg.py +2 -0
  27. torchx/components/utils.py +2 -0
  28. torchx/examples/apps/datapreproc/datapreproc.py +2 -0
  29. torchx/examples/apps/lightning/data.py +2 -0
  30. torchx/examples/apps/lightning/model.py +2 -0
  31. torchx/examples/apps/lightning/profiler.py +2 -0
  32. torchx/examples/apps/lightning/train.py +2 -0
  33. torchx/examples/pipelines/kfp/advanced_pipeline.py +2 -0
  34. torchx/examples/pipelines/kfp/dist_pipeline.py +2 -0
  35. torchx/examples/pipelines/kfp/intro_pipeline.py +2 -0
  36. torchx/notebook.py +2 -0
  37. torchx/pipelines/kfp/__init__.py +2 -0
  38. torchx/pipelines/kfp/adapter.py +3 -2
  39. torchx/pipelines/kfp/version.py +2 -0
  40. torchx/runner/__init__.py +2 -0
  41. torchx/runner/api.py +4 -2
  42. torchx/runner/config.py +14 -0
  43. torchx/runner/events/__init__.py +2 -0
  44. torchx/runner/events/api.py +2 -0
  45. torchx/runner/events/handlers.py +2 -0
  46. torchx/runtime/tracking/__init__.py +2 -0
  47. torchx/runtime/tracking/api.py +2 -0
  48. torchx/schedulers/__init__.py +4 -2
  49. torchx/schedulers/api.py +2 -0
  50. torchx/schedulers/aws_batch_scheduler.py +2 -0
  51. torchx/schedulers/aws_sagemaker_scheduler.py +590 -0
  52. torchx/schedulers/devices.py +2 -0
  53. torchx/schedulers/docker_scheduler.py +22 -5
  54. torchx/schedulers/gcp_batch_scheduler.py +7 -8
  55. torchx/schedulers/ids.py +2 -0
  56. torchx/schedulers/kubernetes_scheduler.py +3 -1
  57. torchx/schedulers/local_scheduler.py +24 -2
  58. torchx/schedulers/lsf_scheduler.py +2 -0
  59. torchx/schedulers/ray/ray_driver.py +6 -6
  60. torchx/schedulers/slurm_scheduler.py +2 -0
  61. torchx/schedulers/streams.py +2 -0
  62. torchx/specs/__init__.py +2 -0
  63. torchx/specs/api.py +14 -3
  64. torchx/specs/builders.py +68 -19
  65. torchx/specs/file_linter.py +8 -2
  66. torchx/specs/finder.py +2 -0
  67. torchx/specs/named_resources_aws.py +2 -0
  68. torchx/specs/named_resources_generic.py +2 -0
  69. torchx/specs/test/components/__init__.py +2 -0
  70. torchx/specs/test/components/a/__init__.py +2 -0
  71. torchx/specs/test/components/a/b/__init__.py +2 -0
  72. torchx/specs/test/components/a/b/c.py +2 -0
  73. torchx/specs/test/components/c/__init__.py +2 -0
  74. torchx/specs/test/components/c/d.py +2 -0
  75. torchx/tracker/__init__.py +2 -0
  76. torchx/tracker/api.py +4 -4
  77. torchx/tracker/backend/fsspec.py +2 -0
  78. torchx/util/cuda.py +2 -0
  79. torchx/util/datetime.py +2 -0
  80. torchx/util/entrypoints.py +2 -0
  81. torchx/util/io.py +2 -0
  82. torchx/util/modules.py +2 -0
  83. torchx/util/shlex.py +2 -0
  84. torchx/util/strings.py +2 -0
  85. torchx/util/types.py +12 -0
  86. torchx/version.py +2 -0
  87. torchx/workspace/__init__.py +2 -0
  88. torchx/workspace/api.py +2 -0
  89. torchx/workspace/dir_workspace.py +2 -0
  90. torchx/workspace/docker_workspace.py +2 -0
  91. {torchx_nightly-2024.2.12.dist-info → torchx_nightly-2024.4.11.dist-info}/METADATA +25 -17
  92. torchx_nightly-2024.4.11.dist-info/RECORD +120 -0
  93. {torchx_nightly-2024.2.12.dist-info → torchx_nightly-2024.4.11.dist-info}/WHEEL +1 -1
  94. torchx_nightly-2024.2.12.dist-info/RECORD +0 -119
  95. {torchx_nightly-2024.2.12.dist-info → torchx_nightly-2024.4.11.dist-info}/LICENSE +0 -0
  96. {torchx_nightly-2024.2.12.dist-info → torchx_nightly-2024.4.11.dist-info}/entry_points.txt +0 -0
  97. {torchx_nightly-2024.2.12.dist-info → torchx_nightly-2024.4.11.dist-info}/top_level.txt +0 -0
torchx/__init__.py CHANGED
@@ -5,6 +5,8 @@
5
5
  # This source code is licensed under the BSD-style license found in the
6
6
  # LICENSE file in the root directory of this source tree.
7
7
 
8
+ # pyre-strict
9
+
8
10
  from .version import ( # noqa F401; noqa F401
9
11
  __version__ as __version__,
10
12
  TORCHX_IMAGE as IMAGE,
@@ -5,6 +5,8 @@
5
5
  # This source code is licensed under the BSD-style license found in the
6
6
  # LICENSE file in the root directory of this source tree.
7
7
 
8
+ # pyre-strict
9
+
8
10
  import argparse
9
11
  import binascii
10
12
  import os
@@ -5,6 +5,8 @@
5
5
  # This source code is licensed under the BSD-style license found in the
6
6
  # LICENSE file in the root directory of this source tree.
7
7
 
8
+ # pyre-strict
9
+
8
10
  import argparse
9
11
  import sys
10
12
  from typing import List
@@ -5,6 +5,8 @@
5
5
  # This source code is licensed under the BSD-style license found in the
6
6
  # LICENSE file in the root directory of this source tree.
7
7
 
8
+ # pyre-strict
9
+
8
10
  import argparse
9
11
  import os
10
12
  import shutil
@@ -5,6 +5,8 @@
5
5
  # This source code is licensed under the BSD-style license found in the
6
6
  # LICENSE file in the root directory of this source tree.
7
7
 
8
+ # pyre-strict
9
+
8
10
  import argparse
9
11
  import subprocess
10
12
  import sys
torchx/cli/__init__.py CHANGED
@@ -4,6 +4,8 @@
4
4
  # This source code is licensed under the BSD-style license found in the
5
5
  # LICENSE file in the root directory of this source tree.
6
6
 
7
+ # pyre-strict
8
+
7
9
  """
8
10
  The ``torchx`` CLI is a commandline tool around :py:class:`torchx.runner.Runner`.
9
11
  It allows users to launch :py:class:`torchx.specs.AppDef` directly onto
@@ -4,19 +4,27 @@
4
4
  # This source code is licensed under the BSD-style license found in the
5
5
  # LICENSE file in the root directory of this source tree.
6
6
 
7
+ # pyre-strict
8
+
9
+ import logging
10
+ import sys
7
11
  from argparse import Action, ArgumentParser, Namespace
8
- from typing import Any, Dict, Optional, Sequence, Text
12
+ from typing import Any, Dict, List, Optional, Sequence, Set, Text
9
13
 
10
14
  from torchx.runner import config
11
15
 
16
+ logger: logging.Logger = logging.getLogger(__name__)
17
+
12
18
 
13
- class _torchxconfig(Action):
19
+ class torchxconfig(Action):
14
20
  """
15
21
  Custom argparse action that loads default torchx CLI options
16
22
  from .torchxconfig file.
17
23
 
18
24
  """
19
25
 
26
+ called_args: Set[str] = set()
27
+
20
28
  # since this action is used for each argparse argument
21
29
  # load the config section for the subcmd once
22
30
  _subcmd_configs: Dict[str, Dict[str, str]] = {}
@@ -64,13 +72,18 @@ class _torchxconfig(Action):
64
72
  values: Any, # pyre-ignore[2] declared as Any in superclass Action
65
73
  option_string: Optional[str] = None,
66
74
  ) -> None:
75
+ if option_string is not None:
76
+ if option_string in self.called_args:
77
+ logger.error(f"{option_string} is specified more than once")
78
+ sys.exit(1)
79
+ self.called_args.add(option_string)
67
80
  setattr(namespace, self.dest, values)
68
81
 
69
82
 
70
83
  # argparse takes the action as a Type[Action] so we can't have custom constructors
71
84
  # hence for each subcommand we need to subclass the base _torchxconfig Action
72
85
  # this is also how store_true and store_false builtin actions are implemented in argparse
73
- class torchxconfig_run(_torchxconfig):
86
+ class torchxconfig_run(torchxconfig):
74
87
  """
75
88
  Custom action that gets the default argument from .torchxconfig.
76
89
  """
@@ -92,3 +105,25 @@ class torchxconfig_run(_torchxconfig):
92
105
  option_strings=option_strings,
93
106
  **kwargs,
94
107
  )
108
+
109
+
110
+ class ArgOnceAction(Action):
111
+ """
112
+ Custom argparse action only allows argument to be specified once
113
+ """
114
+
115
+ called_args: Set[str] = set()
116
+
117
+ def __call__(
118
+ self,
119
+ parser: ArgumentParser,
120
+ namespace: Namespace,
121
+ values: List[str],
122
+ option_string: Optional[str] = None,
123
+ ) -> None:
124
+ if option_string is not None:
125
+ if option_string in self.called_args:
126
+ logger.error(f"{option_string} is specified more than once")
127
+ sys.exit(1)
128
+ self.called_args.add(option_string)
129
+ setattr(namespace, self.dest, values)
torchx/cli/cmd_base.py CHANGED
@@ -4,6 +4,8 @@
4
4
  # This source code is licensed under the BSD-style license found in the
5
5
  # LICENSE file in the root directory of this source tree.
6
6
 
7
+ # pyre-strict
8
+
7
9
  import abc
8
10
  import argparse
9
11
 
torchx/cli/cmd_cancel.py CHANGED
@@ -5,6 +5,8 @@
5
5
  # This source code is licensed under the BSD-style license found in the
6
6
  # LICENSE file in the root directory of this source tree.
7
7
 
8
+ # pyre-strict
9
+
8
10
  import argparse
9
11
  import logging
10
12
 
@@ -5,6 +5,8 @@
5
5
  # This source code is licensed under the BSD-style license found in the
6
6
  # LICENSE file in the root directory of this source tree.
7
7
 
8
+ # pyre-strict
9
+
8
10
  import argparse
9
11
  import logging
10
12
  import sys
@@ -5,6 +5,8 @@
5
5
  # This source code is licensed under the BSD-style license found in the
6
6
  # LICENSE file in the root directory of this source tree.
7
7
 
8
+ # pyre-strict
9
+
8
10
  import argparse
9
11
  import dataclasses
10
12
  import logging
torchx/cli/cmd_list.py CHANGED
@@ -5,6 +5,8 @@
5
5
  # This source code is licensed under the BSD-style license found in the
6
6
  # LICENSE file in the root directory of this source tree.
7
7
 
8
+ # pyre-strict
9
+
8
10
  import argparse
9
11
  import logging
10
12
 
torchx/cli/cmd_log.py CHANGED
@@ -5,6 +5,8 @@
5
5
  # This source code is licensed under the BSD-style license found in the
6
6
  # LICENSE file in the root directory of this source tree.
7
7
 
8
+ # pyre-strict
9
+
8
10
  import argparse
9
11
  import logging
10
12
  import re
torchx/cli/cmd_run.py CHANGED
@@ -4,6 +4,8 @@
4
4
  # This source code is licensed under the BSD-style license found in the
5
5
  # LICENSE file in the root directory of this source tree.
6
6
 
7
+ # pyre-strict
8
+
7
9
  import argparse
8
10
  import logging
9
11
  import os
@@ -15,7 +17,7 @@ from pprint import pformat
15
17
  from typing import Dict, List, Optional, Tuple
16
18
 
17
19
  import torchx.specs as specs
18
- from torchx.cli.argparse_util import torchxconfig_run
20
+ from torchx.cli.argparse_util import ArgOnceAction, torchxconfig_run
19
21
  from torchx.cli.cmd_base import SubCommand
20
22
  from torchx.cli.cmd_log import get_logs
21
23
  from torchx.runner import config, get_runner, Runner
@@ -131,6 +133,7 @@ class CmdRun(SubCommand):
131
133
  "-cfg",
132
134
  "--scheduler_args",
133
135
  type=str,
136
+ action=ArgOnceAction,
134
137
  help="Arguments to pass to the scheduler (Ex:`cluster=foo,user=bar`)."
135
138
  " For a list of scheduler run options run: `torchx runopts`",
136
139
  )
@@ -163,6 +166,7 @@ class CmdRun(SubCommand):
163
166
  subparser.add_argument(
164
167
  "--parent_run_id",
165
168
  type=str,
169
+ action=ArgOnceAction,
166
170
  help="optional parent run ID that this run belongs to."
167
171
  " It can be used to group runs for experiment tracking purposes",
168
172
  )
torchx/cli/cmd_runopts.py CHANGED
@@ -5,6 +5,8 @@
5
5
  # This source code is licensed under the BSD-style license found in the
6
6
  # LICENSE file in the root directory of this source tree.
7
7
 
8
+ # pyre-strict
9
+
8
10
  import argparse
9
11
  import logging
10
12
 
torchx/cli/cmd_status.py CHANGED
@@ -5,6 +5,8 @@
5
5
  # This source code is licensed under the BSD-style license found in the
6
6
  # LICENSE file in the root directory of this source tree.
7
7
 
8
+ # pyre-strict
9
+
8
10
  import argparse
9
11
  import logging
10
12
  import sys
torchx/cli/cmd_tracker.py CHANGED
@@ -4,6 +4,8 @@
4
4
  # This source code is licensed under the BSD-style license found in the
5
5
  # LICENSE file in the root directory of this source tree.
6
6
 
7
+ # pyre-strict
8
+
7
9
  import argparse
8
10
  import logging
9
11
 
torchx/cli/colors.py CHANGED
@@ -5,6 +5,8 @@
5
5
  # This source code is licensed under the BSD-style license found in the
6
6
  # LICENSE file in the root directory of this source tree.
7
7
 
8
+ # pyre-strict
9
+
8
10
  import sys
9
11
 
10
12
  # only print colors if outputting directly to a terminal
torchx/cli/main.py CHANGED
@@ -4,6 +4,8 @@
4
4
  # This source code is licensed under the BSD-style license found in the
5
5
  # LICENSE file in the root directory of this source tree.
6
6
 
7
+ # pyre-strict
8
+
7
9
  import logging
8
10
  import os
9
11
  import sys
@@ -4,6 +4,8 @@
4
4
  # This source code is licensed under the BSD-style license found in the
5
5
  # LICENSE file in the root directory of this source tree.
6
6
 
7
+ # pyre-strict
8
+
7
9
  """
8
10
  This module contains a collection of builtin TorchX components. The directory
9
11
  structure is organized by component category. Components are simply
@@ -4,6 +4,8 @@
4
4
  # This source code is licensed under the BSD-style license found in the
5
5
  # LICENSE file in the root directory of this source tree.
6
6
 
7
+ # pyre-strict
8
+
7
9
  """
8
10
  You can unit test the component definitions as you would normal Python code
9
11
  since they are valid Python definitions.
torchx/components/dist.py CHANGED
@@ -4,6 +4,8 @@
4
4
  # This source code is licensed under the BSD-style license found in the
5
5
  # LICENSE file in the root directory of this source tree.
6
6
 
7
+ # pyre-strict
8
+
7
9
  """
8
10
  For distributed training, TorchX relies on the scheduler's gang scheduling
9
11
  capabilities to schedule ``n`` copies of nodes. Once launched, the application
@@ -4,6 +4,8 @@
4
4
  # This source code is licensed under the BSD-style license found in the
5
5
  # LICENSE file in the root directory of this source tree.
6
6
 
7
+ # pyre-strict
8
+
7
9
  import os
8
10
  import tempfile
9
11
  from abc import ABC, abstractmethod
@@ -4,6 +4,8 @@
4
4
  # This source code is licensed under the BSD-style license found in the
5
5
  # LICENSE file in the root directory of this source tree.
6
6
 
7
+ # pyre-strict
8
+
7
9
  import inspect
8
10
  import logging
9
11
  import sys
@@ -4,6 +4,8 @@
4
4
  # This source code is licensed under the BSD-style license found in the
5
5
  # LICENSE file in the root directory of this source tree.
6
6
 
7
+ # pyre-strict
8
+
7
9
  """
8
10
  These components aim to make it easier to interact with inference and serving
9
11
  tools such as `torchserve <https://pytorch.org/serve/>`_.
@@ -4,6 +4,8 @@
4
4
  # This source code is licensed under the BSD-style license found in the
5
5
  # LICENSE file in the root directory of this source tree.
6
6
 
7
+ # pyre-strict
8
+
7
9
  """
8
10
  Defines methods for structured (higher order) component argument parsing.
9
11
  Use the functionalities defined in this module to author components
@@ -4,6 +4,8 @@
4
4
  # This source code is licensed under the BSD-style license found in the
5
5
  # LICENSE file in the root directory of this source tree.
6
6
 
7
+ # pyre-strict
8
+
7
9
  """
8
10
  This contains TorchX utility components that are `ready-to-use` out of the box. These are
9
11
  components that simply execute well known binaries (e.g. ``cp``)
@@ -5,6 +5,8 @@
5
5
  # This source code is licensed under the BSD-style license found in the
6
6
  # LICENSE file in the root directory of this source tree.
7
7
 
8
+ # pyre-strict
9
+
8
10
  """
9
11
  Data Preprocessing App Example
10
12
  ====================================
@@ -4,6 +4,8 @@
4
4
  # This source code is licensed under the BSD-style license found in the
5
5
  # LICENSE file in the root directory of this source tree.
6
6
 
7
+ # pyre-strict
8
+
7
9
  """
8
10
  Trainer Datasets Example
9
11
  ========================
@@ -4,6 +4,8 @@
4
4
  # This source code is licensed under the BSD-style license found in the
5
5
  # LICENSE file in the root directory of this source tree.
6
6
 
7
+ # pyre-strict
8
+
7
9
  """
8
10
  Tiny ImageNet Model
9
11
  ====================
@@ -5,6 +5,8 @@
5
5
  # This source code is licensed under the BSD-style license found in the
6
6
  # LICENSE file in the root directory of this source tree.
7
7
 
8
+ # pyre-strict
9
+
8
10
  """
9
11
  Simple Logging Profiler
10
12
  ===========================
@@ -5,6 +5,8 @@
5
5
  # This source code is licensed under the BSD-style license found in the
6
6
  # LICENSE file in the root directory of this source tree.
7
7
 
8
+ # pyre-strict
9
+
8
10
  """
9
11
  Trainer Example
10
12
  =============================================
@@ -5,6 +5,8 @@
5
5
  # This source code is licensed under the BSD-style license found in the
6
6
  # LICENSE file in the root directory of this source tree.
7
7
 
8
+ # pyre-strict
9
+
8
10
  """
9
11
  Advanced KubeFlow Pipelines Example
10
12
  ===================================
@@ -5,6 +5,8 @@
5
5
  # This source code is licensed under the BSD-style license found in the
6
6
  # LICENSE file in the root directory of this source tree.
7
7
 
8
+ # pyre-strict
9
+
8
10
  """
9
11
  Distributed KubeFlow Pipelines Example
10
12
  ======================================
@@ -5,6 +5,8 @@
5
5
  # This source code is licensed under the BSD-style license found in the
6
6
  # LICENSE file in the root directory of this source tree.
7
7
 
8
+ # pyre-strict
9
+
8
10
  """
9
11
  Intro KubeFlow Pipelines Example
10
12
  ================================
torchx/notebook.py CHANGED
@@ -5,6 +5,8 @@
5
5
  # This source code is licensed under the BSD-style license found in the
6
6
  # LICENSE file in the root directory of this source tree.
7
7
 
8
+ # pyre-strict
9
+
8
10
  """
9
11
  This contains TorchX utilities for creating and running components and apps from
10
12
  an Jupyter/IPython Notebook.
@@ -5,6 +5,8 @@
5
5
  # This source code is licensed under the BSD-style license found in the
6
6
  # LICENSE file in the root directory of this source tree.
7
7
 
8
+ # pyre-strict
9
+
8
10
  """
9
11
  This module contains adapters for converting TorchX components into KubeFlow
10
12
  Pipeline components.
@@ -5,6 +5,8 @@
5
5
  # This source code is licensed under the BSD-style license found in the
6
6
  # LICENSE file in the root directory of this source tree.
7
7
 
8
+ # pyre-strict
9
+
8
10
  import json
9
11
  import os
10
12
  import os.path
@@ -74,8 +76,7 @@ class ContainerFactory(Protocol):
74
76
  kfp.dsl.ContainerOp.
75
77
  """
76
78
 
77
- def __call__(self, *args: object, **kwargs: object) -> dsl.ContainerOp:
78
- ...
79
+ def __call__(self, *args: object, **kwargs: object) -> dsl.ContainerOp: ...
79
80
 
80
81
 
81
82
  class KFPContainerFactory(ContainerFactory, Protocol):
@@ -5,6 +5,8 @@
5
5
  # This source code is licensed under the BSD-style license found in the
6
6
  # LICENSE file in the root directory of this source tree.
7
7
 
8
+ # pyre-strict
9
+
8
10
  # Follows PEP-0440 version scheme guidelines
9
11
  # https://www.python.org/dev/peps/pep-0440/#version-scheme
10
12
  #
torchx/runner/__init__.py CHANGED
@@ -5,4 +5,6 @@
5
5
  # This source code is licensed under the BSD-style license found in the
6
6
  # LICENSE file in the root directory of this source tree.
7
7
 
8
+ # pyre-strict
9
+
8
10
  from torchx.runner.api import get_runner, Runner # noqa: F401 F403
torchx/runner/api.py CHANGED
@@ -5,6 +5,8 @@
5
5
  # This source code is licensed under the BSD-style license found in the
6
6
  # LICENSE file in the root directory of this source tree.
7
7
 
8
+ # pyre-strict
9
+
8
10
  import json
9
11
  import logging
10
12
  import os
@@ -131,7 +133,7 @@ class Runner:
131
133
  It is ok to call this method multiple times on the same runner object.
132
134
  """
133
135
 
134
- for name, scheduler in self._scheduler_instances.items():
136
+ for scheduler in self._scheduler_instances.values():
135
137
  scheduler.close()
136
138
 
137
139
  def run_component(
@@ -654,7 +656,7 @@ class Runner:
654
656
  def _scheduler_app_id(
655
657
  self,
656
658
  app_handle: AppHandle,
657
- check_session: bool = True
659
+ check_session: bool = True,
658
660
  # pyre-fixme[24]: SchedulerOpts is a generic, and we don't have access to the corresponding type
659
661
  ) -> Tuple[Scheduler, str, str]:
660
662
  """
torchx/runner/config.py CHANGED
@@ -5,6 +5,8 @@
5
5
  # This source code is licensed under the BSD-style license found in the
6
6
  # LICENSE file in the root directory of this source tree.
7
7
 
8
+ # pyre-strict
9
+
8
10
  """
9
11
  Status: Beta
10
12
 
@@ -266,6 +268,13 @@ def dump(
266
268
  val = ";".join(opt.default)
267
269
  else:
268
270
  val = _NONE
271
+ elif opt.opt_type == Dict[str, str]:
272
+ # deal with empty or None default lists
273
+ if opt.default:
274
+ # pyre-ignore[16] opt.default type checked already as Dict[str, str]
275
+ val = ";".join([f"{k}:{v}" for k, v in opt.default.items()])
276
+ else:
277
+ val = _NONE
269
278
  else:
270
279
  val = f"{opt.default}"
271
280
 
@@ -525,6 +534,11 @@ def load(scheduler: str, f: TextIO, cfg: Dict[str, CfgVal]) -> None:
525
534
  cfg[name] = config.getboolean(section, name)
526
535
  elif runopt.opt_type is List[str]:
527
536
  cfg[name] = value.split(";")
537
+ elif runopt.opt_type is Dict[str, str]:
538
+ cfg[name] = {
539
+ s.split(":", 1)[0]: s.split(":", 1)[1]
540
+ for s in value.replace(",", ";").split(";")
541
+ }
528
542
  else:
529
543
  # pyre-ignore[29]
530
544
  cfg[name] = runopt.opt_type(value)
@@ -5,6 +5,8 @@
5
5
  # This source code is licensed under the BSD-style license found in the
6
6
  # LICENSE file in the root directory of this source tree.
7
7
 
8
+ # pyre-strict
9
+
8
10
  """
9
11
  Module contains events processing mechanisms that are integrated with the standard python logging.
10
12
 
@@ -5,6 +5,8 @@
5
5
  # This source code is licensed under the BSD-style license found in the
6
6
  # LICENSE file in the root directory of this source tree.
7
7
 
8
+ # pyre-strict
9
+
8
10
  import json
9
11
  from dataclasses import asdict, dataclass
10
12
  from enum import Enum
@@ -5,6 +5,8 @@
5
5
  # This source code is licensed under the BSD-style license found in the
6
6
  # LICENSE file in the root directory of this source tree.
7
7
 
8
+ # pyre-strict
9
+
8
10
  import logging
9
11
  from typing import Dict
10
12
 
@@ -5,6 +5,8 @@
5
5
  # This source code is licensed under the BSD-style license found in the
6
6
  # LICENSE file in the root directory of this source tree.
7
7
 
8
+ # pyre-strict
9
+
8
10
  """
9
11
  .. note:: EXPERIMENTAL, USE AT YOUR OWN RISK, APIs SUBJECT TO CHANGE
10
12
 
@@ -5,6 +5,8 @@
5
5
  # This source code is licensed under the BSD-style license found in the
6
6
  # LICENSE file in the root directory of this source tree.
7
7
 
8
+ # pyre-strict
9
+
8
10
  import abc
9
11
  import json
10
12
  from typing import Dict, Union
@@ -5,6 +5,8 @@
5
5
  # This source code is licensed under the BSD-style license found in the
6
6
  # LICENSE file in the root directory of this source tree.
7
7
 
8
+ # pyre-strict
9
+
8
10
  import importlib
9
11
  from typing import Dict, Mapping
10
12
 
@@ -19,6 +21,7 @@ DEFAULT_SCHEDULER_MODULES: Mapping[str, str] = {
19
21
  "kubernetes": "torchx.schedulers.kubernetes_scheduler",
20
22
  "kubernetes_mcad": "torchx.schedulers.kubernetes_mcad_scheduler",
21
23
  "aws_batch": "torchx.schedulers.aws_batch_scheduler",
24
+ "aws_sagemaker": "torchx.schedulers.aws_sagemaker_scheduler",
22
25
  "gcp_batch": "torchx.schedulers.gcp_batch_scheduler",
23
26
  "ray": "torchx.schedulers.ray_scheduler",
24
27
  "lsf": "torchx.schedulers.lsf_scheduler",
@@ -27,8 +30,7 @@ DEFAULT_SCHEDULER_MODULES: Mapping[str, str] = {
27
30
 
28
31
  class SchedulerFactory(Protocol):
29
32
  # pyre-fixme: Scheduler opts
30
- def __call__(self, session_name: str, **kwargs: object) -> Scheduler:
31
- ...
33
+ def __call__(self, session_name: str, **kwargs: object) -> Scheduler: ...
32
34
 
33
35
 
34
36
  def _defer_load_scheduler(path: str) -> SchedulerFactory:
torchx/schedulers/api.py CHANGED
@@ -5,6 +5,8 @@
5
5
  # This source code is licensed under the BSD-style license found in the
6
6
  # LICENSE file in the root directory of this source tree.
7
7
 
8
+ # pyre-strict
9
+
8
10
  import abc
9
11
  import re
10
12
  from dataclasses import dataclass, field
@@ -5,6 +5,8 @@
5
5
  # This source code is licensed under the BSD-style license found in the
6
6
  # LICENSE file in the root directory of this source tree.
7
7
 
8
+ # pyre-strict
9
+
8
10
  """
9
11
 
10
12
  This contains the TorchX AWS Batch scheduler which can be used to run TorchX