Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Add more comprehensive error handling #5

Merged
merged 13 commits into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ We use the following tools for linting and formatting:
Style configurations of black and isort can be found in [pyproject.toml](../pyproject.toml).

We use [pre-commit hook](https://pre-commit.com/) that checks and formats for `black`, `isort`, `trailing whitespaces`,
fixes `end-of-files`, sorts `requirments.txt` automatically on every commit.
fixes `end-of-files` automatically on every commit.
The config for a pre-commit hook is stored in [.pre-commit-config](../.pre-commit-config.yaml).

After you clone the repository, you will need to install initialize pre-commit hook.
Expand All @@ -47,21 +47,22 @@ pre-commit install
```

If you are facing an issue when installing markdown lint, you may install ruby for markdown lint by
referring to [this repo](https://github.com/innerlee/setup) by following the usage and taking [`zzruby.sh`](https://github.com/innerlee/setup/blob/master/zzruby.sh)
referring to [this repo](https://github.com/innerlee/setup)
by following the usage and taking [`zzruby.sh`](https://github.com/innerlee/setup/blob/master/zzruby.sh)

or by the following steps
or by the following steps

```shell
```shell
# install rvm
curl -L https://get.rvm.io | bash -s -- --autolibs=read-fail
rvm autolibs disable
# install ruby
# install ruby
rvm install 2.7.1
```

After this on every commit check code linters and formatter will be enforced.

> Before you create a PR, make sure that your code lints and is formatted by yapf.
> Before you create a PR, make sure that your code lints and is formatted by black.

### C++ and CUDA

Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,15 @@

<br/>

<div align="center">

[![Documentation](https://readthedocs.org/projects/xrfeitoria/badge/?version=latest)](https://xrfeitoria.readthedocs.io/en/latest/?badge=latest)
[![actions](https://github.com/openxrlab/xrfeitoria/workflows/lint/badge.svg)](https://github.com/openxrlab/xrfeitoria/actions)
[![PyPI](https://img.shields.io/pypi/v/xrfeitoria)](https://pypi.org/project/xrfeitoria/)
[![license](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0)

</div>

## Introduction

XRFeitoria is a rendering toolbox for generating synthetic data photorealistic with ground-truth annotations.
Expand Down Expand Up @@ -64,7 +68,7 @@ xf-render bunny.obj
### Tutorials

There are several [tutorials](/tutorials/).
You can read them [here](https://openxrlab-share.oss-cn-hongkong.aliyuncs.com/xrfeitoria/docs/en/_build/html/src/Tutorials.html).
You can read them [here](https://xrfeitoria.readthedocs.io/en/latest/src/Tutorials.html).


### Sample codes
Expand Down
6 changes: 2 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ requires-python = ">=3.8, <3.11"
license = { text = 'Apache License 2.0' }
classifiers = [
"Operating System :: Microsoft :: Windows",
"Operating System :: Unix",
"Operating System :: MacOS :: MacOS",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
Expand Down Expand Up @@ -56,10 +58,6 @@ doc = [
"sphinx-rtd-theme==1.3.0",
"sphinx-tabs==3.4.1",
"enum-tools[sphinx]",

# https://graphviz.org/download/#windows
# sudo apt install pandoc
# sudo apt install graphviz
]

[project.urls]
Expand Down
12 changes: 10 additions & 2 deletions samples/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
# Samples

## Configure
First, configure the **executable path** of blender or unreal by execute:
## Clone

```bash
git clone https://github.com/openxrlab/xrfeitoria.git
cd xrfeitoria
```

## Setup the environment

After [installation](../README.md#Installation), configure the **executable path** of blender or unreal by executing:

```bash
python -m samples.setup
Expand Down
File renamed without changes.
5 changes: 0 additions & 5 deletions tutorials/01_get_started.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,6 @@
"source": [
"Ref to [api docs](../../apis/xrfeitoria.rst), you can always use ``with`` statement to ensure the engine is closed when the codes are finished."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": []
}
],
"metadata": {
Expand Down
25 changes: 22 additions & 3 deletions xrfeitoria/utils/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,28 @@ def __init__(
if not self.engine_exec.exists() or not self.engine_exec.is_file():
raise FileExistsError(f'Engine executable not valid: {self.engine_exec}')
logger.info(f'Using engine executable: "{self.engine_exec.as_posix()}"')
self.project_path = Path(project_path).resolve() if project_path else None
if project_path:
self.project_path = Path(project_path).resolve()
assert self.project_path.exists(), (
f'Project path not valid: "{self.project_path.as_posix()}"\n'
'Please check in `xf.init_blender(project_path=...)` or `xf.init_unreal(project_path=...)`'
HaiyiMei marked this conversation as resolved.
Show resolved Hide resolved
)
if self.engine_type == EngineEnum.blender:
assert self.project_path.suffix == '.blend', (
f'Project path not valid: "{self.project_path.as_posix()}"\n'
'Please use a blender project file (.blend) file as project path in `xf.init_blender(project_path=...)`'
)
elif self.engine_type == EngineEnum.unreal:
assert self.project_path.suffix == '.uproject', (
f'Project path not valid: "{self.project_path.as_posix()}"\n'
'Please use a unreal project file (.uproject) as project path in `xf.init_unreal(project_path=...)`'
)
else:
assert (
self.engine_type != EngineEnum.unreal
), 'Please specify a project path in `xf.init_unreal(project_path=...)` when using unreal engine'
self.project_path = None
self.engine_info: Tuple[str, str] = self._get_engine_info(self.engine_exec)
if self.engine_type == EngineEnum.unreal and (self.project_path is None or not self.project_path.exists()):
raise FileExistsError(f'Project path not valid: "{self.project_path}"')

@property
def port(self) -> int:
Expand Down Expand Up @@ -558,6 +576,7 @@ def _start_rpc(self, background: bool = True, project_path: Optional[Path] = '')
)
process = self._popen(cmd)

# TODO: check if process is running
self.wait_for_start()
# logger.info(f'Started {" ".join(self.engine_info)} with RPC server at port {self.port}')
self.engine_process = process
Expand Down
Loading