Skip to content

Commit 11df990

Browse files
authored
Validation for pipeline and appdef components
Differential Revision: D71297049 Pull Request resolved: #1024
1 parent 5d69ea0 commit 11df990

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

torchx/specs/file_linter.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,11 @@ def _validate_arg_def(
180180

181181

182182
class TorchxReturnValidator(TorchxFunctionValidator):
183+
184+
def __init__(self, supported_return_type: str) -> None:
185+
super().__init__()
186+
self._supported_return_type = supported_return_type
187+
183188
def _get_return_annotation(
184189
self, app_specs_func_def: ast.FunctionDef
185190
) -> Optional[str]:
@@ -203,7 +208,7 @@ def validate(self, app_specs_func_def: ast.FunctionDef) -> List[LinterMessage]:
203208
* AppDef
204209
* specs.AppDef
205210
"""
206-
supported_return_annotation = "AppDef"
211+
supported_return_annotation = self._supported_return_type
207212
return_annotation = self._get_return_annotation(app_specs_func_def)
208213
linter_errors = []
209214
if not return_annotation:
@@ -252,7 +257,7 @@ def __init__(
252257
if validators is None:
253258
self.validators: List[TorchxFunctionValidator] = [
254259
TorchxFunctionArgsValidator(),
255-
TorchxReturnValidator(),
260+
TorchxReturnValidator("AppDef"),
256261
]
257262
else:
258263
self.validators = validators

0 commit comments

Comments
 (0)