From b2b0255a22b8141df0011c669bd00bb123199ed0 Mon Sep 17 00:00:00 2001 From: Chengshu Li Date: Fri, 4 Oct 2024 15:57:49 -0700 Subject: [PATCH 1/6] fix mixing rule transition rule tests --- tests/test_transition_rules.py | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/tests/test_transition_rules.py b/tests/test_transition_rules.py index 5ef1eeb51..ddece38da 100644 --- a/tests/test_transition_rules.py +++ b/tests/test_transition_rules.py @@ -466,7 +466,12 @@ def test_mixing_rule_failure_recipe_systems(env): assert lemonade.n_particles == 0 assert sludge.n_particles == 0 - tablespoon.set_position_orientation(position=[0.04, 0.0, 0.08], orientation=[0, 0, 0, 1]) + # Move the tablespoon to touch the bowl + tablespoon.set_position_orientation( + position=[0.10, 0.0, 0.01], orientation=T.euler2quat(th.tensor([0.0, math.pi / 2, 0.0])) + ) + tablespoon.keep_still() + tablespoon.set_linear_velocity(th.tensor([-1.0, 0.0, 0.0])) og.sim.step() assert tablespoon.states[Touching].get_value(bowl) @@ -510,7 +515,12 @@ def test_mixing_rule_failure_nonrecipe_systems(env): assert lemonade.n_particles == 0 assert sludge.n_particles == 0 - tablespoon.set_position_orientation(position=[0.04, 0.0, 0.08], orientation=[0, 0, 0, 1]) + # Move the tablespoon to touch the bowl + tablespoon.set_position_orientation( + position=[0.10, 0.0, 0.01], orientation=T.euler2quat(th.tensor([0.0, math.pi / 2, 0.0])) + ) + tablespoon.keep_still() + tablespoon.set_linear_velocity(th.tensor([-1.0, 0.0, 0.0])) og.sim.step() assert tablespoon.states[Touching].get_value(bowl) @@ -550,7 +560,12 @@ def test_mixing_rule_success(env): assert lemonade.n_particles == 0 - tablespoon.set_position_orientation(position=[0.04, 0.0, 0.08], orientation=[0, 0, 0, 1]) + # Move the tablespoon to touch the bowl + tablespoon.set_position_orientation( + position=[0.10, 0.0, 0.01], orientation=T.euler2quat(th.tensor([0.0, math.pi / 2, 0.0])) + ) + tablespoon.keep_still() + tablespoon.set_linear_velocity(th.tensor([-1.0, 0.0, 0.0])) og.sim.step() assert tablespoon.states[Touching].get_value(bowl) From 1d780c99c1374d243d2370cee0fb3d496ebb09a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cem=20G=C3=B6kmen?= <1408354+cgokmen@users.noreply.github.com> Date: Tue, 15 Oct 2024 13:24:37 -0700 Subject: [PATCH 2/6] Re-create dev docker image and remove requirements-dev.txt --- .github/workflows/build-push-containers.yml | 32 ++++++++++++++++++--- .github/workflows/examples-as-test.yml | 24 ++++------------ .github/workflows/profiling.yml | 16 ++--------- .github/workflows/tests.yml | 16 ++--------- docker/build_docker.sh | 8 ++++++ docker/gh-actions/Dockerfile | 4 +-- docker/prod.Dockerfile | 10 +++++-- requirements-dev.txt | 12 -------- setup.py | 17 ++++++++++- 9 files changed, 72 insertions(+), 67 deletions(-) delete mode 100644 requirements-dev.txt diff --git a/.github/workflows/build-push-containers.yml b/.github/workflows/build-push-containers.yml index b01ab1dba..099f02060 100644 --- a/.github/workflows/build-push-containers.yml +++ b/.github/workflows/build-push-containers.yml @@ -77,6 +77,16 @@ jobs: tags: | type=ref,event=branch type=semver,pattern={{version}} + - + name: Metadata for dev Image + id: meta-dev + uses: docker/metadata-action@v5 + with: + images: | + stanfordvl/omnigibson-dev + tags: | + type=ref,event=branch + type=semver,pattern={{version}} - name: Metadata for vscode Image id: meta-vscode @@ -97,8 +107,22 @@ jobs: tags: ${{ steps.meta-prod.outputs.tags }} labels: ${{ steps.meta-prod.outputs.labels }} file: docker/prod.Dockerfile - cache-from: type=gha - cache-to: type=gha,mode=min + cache-from: type=registry,ref=stanfordvl/omnigibson:og-develop + cache-to: type=inline + + - + name: Build and push dev image + id: build-dev + uses: docker/build-push-action@v5 + with: + context: . + build-args: "DEV_MODE=1" + push: true + tags: ${{ steps.meta-dev.outputs.tags }} + labels: ${{ steps.meta-dev.outputs.labels }} + file: docker/prod.Dockerfile + cache-from: type=registry,ref=stanfordvl/omnigibson:og-develop # OK to share cache here. + cache-to: type=inline - name: Update vscode image Dockerfile with prod image tag run: | @@ -113,5 +137,5 @@ jobs: tags: ${{ steps.meta-vscode.outputs.tags }} labels: ${{ steps.meta-vscode.outputs.labels }} file: docker/vscode.Dockerfile - cache-from: type=gha - cache-to: type=gha,mode=min + cache-from: type=registry,ref=stanfordvl/omnigibson:og-develop # OK to share cache here. + cache-to: type=inline diff --git a/.github/workflows/examples-as-test.yml b/.github/workflows/examples-as-test.yml index 019a0a2f4..7d595ae85 100644 --- a/.github/workflows/examples-as-test.yml +++ b/.github/workflows/examples-as-test.yml @@ -25,20 +25,10 @@ jobs: with: submodules: true path: omnigibson-src - - # These are temporarily disabled due to some errors they cause where some - # unknown important dependency has its version changed and Isaac Sim will - # no longer launch properly. The result is that if dependencies change, - # the tests will stop working. This is a temporary fix until we can figure - # out how to fix this issue. - - # - name: Install dev requirements - # working-directory: omnigibson-src - # run: pip install -r requirements-dev.txt - - # - name: Install - # working-directory: omnigibson-src - # run: pip install -e . + + - name: Install + working-directory: omnigibson-src + run: pip install -e .[dev] - name: Generate example tests working-directory: omnigibson-src @@ -84,13 +74,9 @@ jobs: submodules: true path: omnigibson-src - - name: Install dev requirements - working-directory: omnigibson-src - run: pip install -r requirements-dev.txt - - name: Install working-directory: omnigibson-src - run: pip install -e . + run: pip install -e .[dev] - name: Run tests working-directory: omnigibson-src diff --git a/.github/workflows/profiling.yml b/.github/workflows/profiling.yml index b517c9d23..a6ccba29f 100644 --- a/.github/workflows/profiling.yml +++ b/.github/workflows/profiling.yml @@ -32,19 +32,9 @@ jobs: - name: Checkout source uses: actions/checkout@v3 - # These are temporarily disabled due to some errors they cause where some - # unknown important dependency has its version changed and Isaac Sim will - # no longer launch properly. The result is that if dependencies change, - # the tests will stop working. This is a temporary fix until we can figure - # out how to fix this issue. - - # - name: Install dev requirements - # working-directory: omnigibson-src - # run: pip install -r requirements-dev.txt - - # - name: Install - # working-directory: omnigibson-src - # run: pip install -e . + - name: Install + working-directory: omnigibson-src + run: pip install -e .[dev] - name: Run performance benchmark run: bash scripts/profiling.sh diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 477cb5a01..2c1f8eef0 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -49,19 +49,9 @@ jobs: submodules: true path: omnigibson-src - # These are temporarily disabled due to some errors they cause where some - # unknown important dependency has its version changed and Isaac Sim will - # no longer launch properly. The result is that if dependencies change, - # the tests will stop working. This is a temporary fix until we can figure - # out how to fix this issue. - - # - name: Install dev requirements - # working-directory: omnigibson-src - # run: pip install -r requirements-dev.txt - - # - name: Install - # working-directory: omnigibson-src - # run: pip install -e . + - name: Install + working-directory: omnigibson-src + run: pip install -e .[dev] - name: Print env run: printenv diff --git a/docker/build_docker.sh b/docker/build_docker.sh index 739ab3dad..0f091fe7f 100755 --- a/docker/build_docker.sh +++ b/docker/build_docker.sh @@ -7,6 +7,14 @@ docker build \ -f docker/prod.Dockerfile \ . +# Pass the DEV_MODE=1 arg to the docker build command to build the development image +docker build \ + -t stanfordvl/omnigibson-dev:latest \ + -t stanfordvl/omnigibson-dev:$(sed -ne "s/.*version= *['\"]\([^'\"]*\)['\"] *.*/\1/p" setup.py) \ + -f docker/prod.Dockerfile \ + --build-arg DEV_MODE=1 \ + . + docker build \ -t stanfordvl/omnigibson-vscode:latest \ -f docker/vscode.Dockerfile \ diff --git a/docker/gh-actions/Dockerfile b/docker/gh-actions/Dockerfile index 486e5eda4..b8ab23255 100644 --- a/docker/gh-actions/Dockerfile +++ b/docker/gh-actions/Dockerfile @@ -1,4 +1,4 @@ -FROM stanfordvl/omnigibson:og-develop +FROM stanfordvl/omnigibson-dev:og-develop ARG DUMB_INIT_VERSION="1.2.2" ARG GIT_CORE_PPA_KEY="A1715D88E1DF1F24" @@ -99,7 +99,7 @@ RUN echo en_US.UTF-8 UTF-8 >> /etc/locale.gen \ ENV AGENT_TOOLSDIRECTORY=/opt/hostedtoolcache RUN mkdir -p /opt/hostedtoolcache -ARG GH_RUNNER_VERSION="2.311.0" +ARG GH_RUNNER_VERSION="2.320.0" ARG TARGETPLATFORM diff --git a/docker/prod.Dockerfile b/docker/prod.Dockerfile index d42f85732..f426f674d 100644 --- a/docker/prod.Dockerfile +++ b/docker/prod.Dockerfile @@ -67,8 +67,12 @@ WORKDIR /omnigibson-src SHELL ["micromamba", "run", "-n", "omnigibson", "/bin/bash", "--login", "-c"] -# Install OmniGibson -RUN micromamba run -n omnigibson pip install -e . +# Optionally install OmniGibson (e.g. unless the DEV_MODE flag is set) +ARG DEV_MODE +ENV DEV_MODE=${DEV_MODE} +RUN if [ "$DEV_MODE" != "1" ]; then \ + micromamba run -n omnigibson pip install -e .[dev]; \ + fi -ENTRYPOINT ["micromamba", "run", "-n", "omnigibson"] + ENTRYPOINT ["micromamba", "run", "-n", "omnigibson"] CMD ["/bin/bash"] \ No newline at end of file diff --git a/requirements-dev.txt b/requirements-dev.txt deleted file mode 100644 index fe014a845..000000000 --- a/requirements-dev.txt +++ /dev/null @@ -1,12 +0,0 @@ -pytest>=6.2.3 -pytest-cov>=3.0.0 -pytest_rerunfailures -mkdocs -mkdocs-autorefs -mkdocs-gen-files -mkdocs-material -mkdocs-material-extensions -mkdocstrings[python] -mkdocs-section-index -mkdocs-literate-nav -telemoma~=0.1.2 diff --git a/setup.py b/setup.py index 074bdc650..bdc3724aa 100644 --- a/setup.py +++ b/setup.py @@ -48,7 +48,22 @@ "graphviz~=0.20", "matplotlib>=3.0.0", ], - extras_require={}, + extras_require={ + "dev": [ + "pytest>=6.2.3", + "pytest-cov>=3.0.0", + "pytest_rerunfailures", + "mkdocs", + "mkdocs-autorefs", + "mkdocs-gen-files", + "mkdocs-material", + "mkdocs-material-extensions", + "mkdocstrings[python]", + "mkdocs-section-index", + "mkdocs-literate-nav", + "telemoma~=0.1.2", + ] + }, tests_require=[], python_requires=">=3", include_package_data=True, From 3cc8748b551b502f7ecdce020ace181afd6bc5e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cem=20G=C3=B6kmen?= Date: Wed, 16 Oct 2024 12:30:25 -0700 Subject: [PATCH 3/6] Remove OmniGibson from Docker dev image --- docker/prod.Dockerfile | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/docker/prod.Dockerfile b/docker/prod.Dockerfile index f426f674d..c08cc792a 100644 --- a/docker/prod.Dockerfile +++ b/docker/prod.Dockerfile @@ -59,20 +59,30 @@ RUN micromamba run -n omnigibson /bin/bash --login -c 'source /isaac-sim/setup_c RUN micromamba run -n omnigibson python -c "from ompl import base" # Add setup to be executed on bash launch -RUN echo "OMNIGIBSON_NO_OMNIVERSE=1 python omnigibson/download_datasets.py" >> /root/.bashrc +RUN # Copy over omnigibson source ADD . /omnigibson-src WORKDIR /omnigibson-src +# Set the shell SHELL ["micromamba", "run", "-n", "omnigibson", "/bin/bash", "--login", "-c"] -# Optionally install OmniGibson (e.g. unless the DEV_MODE flag is set) +# Optionally install OmniGibson (e.g. unless the DEV_MODE flag is set) or +# remove the OmniGibson source code if we are in dev mode and change the workdir ARG DEV_MODE ENV DEV_MODE=${DEV_MODE} +ARG WORKDIR_PATH=/omnigibson-src RUN if [ "$DEV_MODE" != "1" ]; then \ - micromamba run -n omnigibson pip install -e .[dev]; \ + echo "OMNIGIBSON_NO_OMNIVERSE=1 python omnigibson/download_datasets.py" >> /root/.bashrc; \ + micromamba run -n omnigibson pip install -e .[dev]; \ + else \ + WORKDIR_PATH=/; \ + cd / && rm -rf /omnigibson-src; \ fi - ENTRYPOINT ["micromamba", "run", "-n", "omnigibson"] +# Reset the WORKDIR based on whether or not we are in dev mode +WORKDIR ${WORKDIR_PATH} + +ENTRYPOINT ["micromamba", "run", "-n", "omnigibson"] CMD ["/bin/bash"] \ No newline at end of file From 65edcf016627620c0d1bdc5b92fc1b82a39741bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cem=20G=C3=B6kmen?= Date: Wed, 16 Oct 2024 12:31:56 -0700 Subject: [PATCH 4/6] Update prod.Dockerfile --- docker/prod.Dockerfile | 3 --- 1 file changed, 3 deletions(-) diff --git a/docker/prod.Dockerfile b/docker/prod.Dockerfile index c08cc792a..e30aaf5ee 100644 --- a/docker/prod.Dockerfile +++ b/docker/prod.Dockerfile @@ -58,9 +58,6 @@ RUN micromamba run -n omnigibson /bin/bash --login -c 'source /isaac-sim/setup_c # Test OMPL RUN micromamba run -n omnigibson python -c "from ompl import base" -# Add setup to be executed on bash launch -RUN - # Copy over omnigibson source ADD . /omnigibson-src WORKDIR /omnigibson-src From cfab0583d6f60b155b4b41ab13c74a2f2b3102cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cem=20G=C3=B6kmen?= Date: Wed, 16 Oct 2024 22:17:36 -0700 Subject: [PATCH 5/6] Unpin dependency versions --- setup.py | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/setup.py b/setup.py index bdc3724aa..9d7f8d331 100644 --- a/setup.py +++ b/setup.py @@ -24,28 +24,28 @@ "gymnasium>=0.28.1", "numpy<2.0.0,>=1.23.5", "scipy>=1.10.1", - "GitPython~=3.1.40", - "transforms3d~=0.4.1", - "networkx~=3.2.1", - "PyYAML~=6.0.1", - "addict~=2.4.0", - "ipython~=8.20.0", - "future~=0.18.3", - "trimesh~=4.0.8", - "h5py~=3.10.0", - "cryptography~=41.0.7", + "GitPython>=3.1.40", + "transforms3d>=0.4.1", + "networkx>=3.2.1", + "PyYAML>=6.0.1", + "addict>=2.4.0", + "ipython>=8.20.0", + "future>=0.18.3", + "trimesh>=4.0.8", + "h5py>=3.10.0", + "cryptography>=41.0.7", "bddl~=3.5.0", "opencv-python>=4.8.1", - "nest_asyncio~=1.5.8", - "imageio~=2.33.1", - "imageio-ffmpeg~=0.4.9", - "termcolor~=2.4.0", - "progressbar~=2.5", + "nest_asyncio>=1.5.6", + "imageio>=2.33.1", + "imageio-ffmpeg>=0.4.9", + "termcolor>=2.4.0", + "progressbar>=2.5", "pymeshlab~=2022.2", - "click~=8.1.3", - "aenum~=3.1.15", - "rtree~=1.2.0", - "graphviz~=0.20", + "click>=8.1.3", + "aenum>=3.1.15", + "rtree>=1.2.0", + "graphviz>=0.20", "matplotlib>=3.0.0", ], extras_require={ From a52fa1297704c9160ada220ad6e129d018d7c075 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cem=20G=C3=B6kmen?= Date: Wed, 16 Oct 2024 23:45:49 -0700 Subject: [PATCH 6/6] Fix transform utils test --- tests/test_transform_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_transform_utils.py b/tests/test_transform_utils.py index 36d1802bc..318dfae81 100644 --- a/tests/test_transform_utils.py +++ b/tests/test_transform_utils.py @@ -358,7 +358,7 @@ def test_quat_slerp(self): key_rots = R.from_quat(np.stack([q1.cpu().numpy(), q2.cpu().numpy()])) key_times = [0, 1] slerp = Slerp(key_times, key_rots) - scipy_q_slerp = slerp([t]).as_quat()[0].astype(NumpyTypes.FLOAT32) + scipy_q_slerp = slerp([t.item()]).as_quat()[0].astype(NumpyTypes.FLOAT32) assert quaternions_close(q_slerp, th.from_numpy(scipy_q_slerp)) assert_close(th.norm(q_slerp), th.tensor(1.0))