Skip to content

Commit

Permalink
dependencies: unpin pyre and fix issues (#706)
Browse files Browse the repository at this point in the history
  • Loading branch information
d4l3k committed Mar 17, 2023
1 parent f1e19c5 commit 3267fa9
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 10 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/pyre.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,5 @@ jobs:
run: |
set -eux
pip install -e .[dev]
VERSION=$(grep "version" .pyre_configuration | sed -n -e 's/.*\(0\.0\.[0-9]*\).*/\1/p')
pip install pyre-check-nightly==$VERSION
- name: Run Pyre
run: scripts/pyre.sh
3 changes: 1 addition & 2 deletions .pyre_configuration
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,5 @@
"search_path": [
"stubs"
],
"strict": true,
"version": "0.0.101662549039"
"strict": true
}
3 changes: 2 additions & 1 deletion dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ hydra-core
ipython
kfp==1.8.9
moto==4.1.3
pyre-extensions==0.0.29
pyre-extensions
pyre-check
pytest
pytorch-lightning==1.5.10
torch-model-archiver>=0.4.2
Expand Down
1 change: 0 additions & 1 deletion scripts/kfpint.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@

def get_fn_name(fn: Callable[..., T]) -> str:
if hasattr(fn, "__qualname__"):
# pyre-ignore[16]
return fn.__qualname__
elif hasattr(fn, "__name__"):
return fn.__name__
Expand Down
5 changes: 4 additions & 1 deletion torchx/components/component_test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@ def validate(self, module: ModuleType, function_name: str) -> None:
"""

# make it the same as a custom component (e.g. /abs/path/to/component.py:train)
component_id = f"{os.path.abspath(module.__file__)}:{function_name}"
module_path = module.__file__
assert module_path, f"module must have __file__: {module_path}"
module_path = os.path.abspath(module_path)
component_id = f"{module_path}:{function_name}"
component_def = get_component(component_id)

# on `--help` argparse will print the help message and exit 0
Expand Down
5 changes: 3 additions & 2 deletions torchx/schedulers/test/local_scheduler_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,6 @@ def test_submit(self) -> None:
expected_app_id = make_unique(app.name)
cfg = {"log_dir": self.test_dir}
with patch(LOCAL_SCHEDULER_MAKE_UNIQUE, return_value=expected_app_id):

app_id = self.scheduler.submit(app, cfg)

self.assertEqual(f"{expected_app_id}", app_id)
Expand Down Expand Up @@ -282,7 +281,9 @@ def test_submit_cleanup(self) -> None:
app = AppDef(name="test_app", roles=[role])
self.scheduler.submit(app, cfg={})
self.scheduler.close()
self.assertFalse(os.path.exists(self.scheduler._base_log_dir))
base_log_dir = self.scheduler._base_log_dir
self.assertIsNotNone(base_log_dir)
self.assertFalse(os.path.exists(base_log_dir))
self.assertTrue(self.scheduler._created_tmp_log_dir)

def test_macros_env(self) -> None:
Expand Down
4 changes: 3 additions & 1 deletion torchx/specs/finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,9 @@ def _get_components_from_module(self, module: ModuleType) -> List[_Component]:
functions = getmembers(module, isfunction)
component_defs = []

module_path = os.path.abspath(module.__file__)
module_path = module.__file__
assert module_path, f"module must have __file__: {module_path}"
module_path = os.path.abspath(module_path)
rel_module_name = module_relname(module, relative_to=self.base_module)
for function_name, function in functions:
linter_errors = validate(module_path, function_name)
Expand Down

0 comments on commit 3267fa9

Please sign in to comment.