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

Update morpheus dev container to support flag for building with debug python build + source files. #81

Merged
8 commits merged into from
May 17, 2022

Conversation

drobison00
Copy link
Contributor

resolves #21

Add the ability to build the morpheus dev container with a debug build of cpython + source libraries.

@drobison00
Copy link
Contributor Author

@mdemoret-nv @pdmack Please take a look when you're able.

@drobison00 drobison00 added enhancement Additional functionality added to an existing feature non-breaking Non-breaking change feature request New feature or request 3 - Ready for Review labels May 4, 2022
@drobison00 drobison00 changed the title Dvn fea issue 21 Update morpheus dev container to support flag for building with debug python build + source files. May 4, 2022
Copy link
Contributor

@mdemoret-nv mdemoret-nv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love this feature but I dont think it needs to be included in our development docker image like it currently is. This is hopefully going to be a very rarely used tool that makes more sense as a post development build stage to make it opt-in.

My comments can be summarized by:

  1. Add a section to ci/conda/recipes/run_conda_build.sh to run the recipe similar to the other recipes in that script
  2. Make a script for installing the built conda package to clean up the Dockerfile and allow the debug python package to be installed outside of a container (for example, somewhere in ci/conda/recipes/python-dbg should work)
  3. Move all of the Dockerfile changes to a post-development build stage.

docker/Dockerfile Outdated Show resolved Hide resolved
docker/Dockerfile Outdated Show resolved Hide resolved
docker/Dockerfile Outdated Show resolved Hide resolved
docker/Dockerfile Outdated Show resolved Hide resolved
@pdmack
Copy link
Contributor

pdmack commented May 5, 2022

Couldn't get this to build (based on updated CONTRIBUTING.md)

#27 7.962 tar: Python-3.8.12/Include/*: Not found in archive
#27 7.962 tar: Exiting with failure status due to previous errors
#27 9.241 tar: Python-3.8.12/Misc/*: Not found in archive
#27 9.241 tar: Exiting with failure status due to previous errors
#27 10.52 tar: Python-3.8.12/Modules/*: Not found in archive
#27 10.52 tar: Exiting with failure status due to previous errors
#27 11.80 tar: Python-3.8.12/Objects/*: Not found in archive
#27 11.80 tar: Exiting with failure status due to previous errors
#27 13.05 tar: Python-3.8.12/Python/*: Not found in archive
#27 13.05 tar: Exiting with failure status due to previous errors
#27 ERROR: executor failed running [/bin/bash -c if [[ "${MORPHEUS_WITH_PYDEBUG}" =~ ^(TRUE|True|true|1)$ ]]; then       source activate morpheus       && export source_file=$( ls /opt/conda/conda-bld/src_cache/Python-${PYTHON_VER}*.tar.xz )       && export install_file=$( ls /opt/conda/conda-bld/linux-64/python-${PYTHON_VER}*.tar.bz2 )       && mamba install --use-local ${install_file}       && export debug_py_ver=$(python --version | cut -d ' ' -f2)       && cp -R /opt/conda/envs/morpheus/include/python${PYTHON_VER}d/*         /opt/conda/envs/morpheus/include/python${PYTHON_VER}       && for src in Include Misc Modules Objects Python; do            tar --strip-components=1 --extract --wildcards --file=${source_file} Python-${debug_py_ver}/${src}/*           && mkdir -p /usr/local/src/python-dbg/${src}           && cp -R ./${src} /usr/local/src/python-dbg/${src}           ;          done       && cp Misc/gdbinit $(eval echo "~${MORPHEUS_USER}")/.gdbinit       ;     fi]: exit code: 2
------
 > [development 3/3] RUN --mount=type=bind,from=development_deps,source=/opt/conda/conda-bld,target=/opt/conda/conda-bld     if [[ "true" =~ ^(TRUE|True|true|1)$ ]]; then       source activate morpheus       && export source_file=$( ls /opt/conda/conda-bld/src_cache/Python-3.8*.tar.xz )       && export install_file=$( ls /opt/conda/conda-bld/linux-64/python-3.8*.tar.bz2 )       && mamba install --use-local ${install_file}       && export debug_py_ver=$(python --version | cut -d ' ' -f2)       && cp -R /opt/conda/envs/morpheus/include/python3.8d/*         /opt/conda/envs/morpheus/include/python3.8       && for src in Include Misc Modules Objects Python; do            tar --strip-components=1 --extract --wildcards --file=${source_file} Python-${debug_py_ver}/${src}/*           && mkdir -p /usr/local/src/python-dbg/${src}           && cp -R ./${src} /usr/local/src/python-dbg/${src}           ;          done       && cp Misc/gdbinit $(eval echo "~root")/.gdbinit       ;     fi:
#27 7.962 tar: Python-3.8.12/Include/*: Not found in archive
#27 7.962 tar: Exiting with failure status due to previous errors
#27 9.241 tar: Python-3.8.12/Misc/*: Not found in archive
#27 9.241 tar: Exiting with failure status due to previous errors
#27 10.52 tar: Python-3.8.12/Modules/*: Not found in archive
#27 10.52 tar: Exiting with failure status due to previous errors
#27 11.80 tar: Python-3.8.12/Objects/*: Not found in archive
#27 11.80 tar: Exiting with failure status due to previous errors
#27 13.05 tar: Python-3.8.12/Python/*: Not found in archive
#27 13.05 tar: Exiting with failure status due to previous errors
------
error: failed to solve: executor failed running [/bin/bash -c if [[ "${MORPHEUS_WITH_PYDEBUG}" =~ ^(TRUE|True|true|1)$ ]]; then       source activate morpheus       && export source_file=$( ls /opt/conda/conda-bld/src_cache/Python-${PYTHON_VER}*.tar.xz )       && export install_file=$( ls /opt/conda/conda-bld/linux-64/python-${PYTHON_VER}*.tar.bz2 )       && mamba install --use-local ${install_file}       && export debug_py_ver=$(python --version | cut -d ' ' -f2)       && cp -R /opt/conda/envs/morpheus/include/python${PYTHON_VER}d/*         /opt/conda/envs/morpheus/include/python${PYTHON_VER}       && for src in Include Misc Modules Objects Python; do            tar --strip-components=1 --extract --wildcards --file=${source_file} Python-${debug_py_ver}/${src}/*           && mkdir -p /usr/local/src/python-dbg/${src}           && cp -R ./${src} /usr/local/src/python-dbg/${src}           ;          done       && cp Misc/gdbinit $(eval echo "~${MORPHEUS_USER}")/.gdbinit       ;     fi]: exit code: 2

@drobison00
Copy link
Contributor Author

drobison00 commented May 6, 2022

@pdmack That's odd, for some reason the install script isn't running in the morpheus conda environment for you, so its detecting the python version in the base environment... I'll investigate more. Not at all clear why it works on my side.

Edit: I'd switched to using the wrong environment variables in the build file. Conda build defines PY_VER, but I was using PYTHON_VER, which broke some post build symbolic links. Fixed now.

@drobison00
Copy link
Contributor Author

@pdmack @mdemoret-nv All the updates are in; morpheus builds without any issues in container, tests passing, etc.. should be good to go if there are no other concerns.

@pdmack
Copy link
Contributor

pdmack commented May 9, 2022

LGTM
Not sure if we want to sprinkle in a pdb breakpoint example or some such?

Copy link
Contributor

@pdmack pdmack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@drobison00
Copy link
Contributor Author

LGTM Not sure if we want to sprinkle in a pdb breakpoint example or some such?

If @mdemoret-nv doesn't have any other change requests, I'll add a quick example of breaking within a the cpython evaluation loop and printing object contents.

Copy link
Contributor

@mdemoret-nv mdemoret-nv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Only one small question.

ci/conda/recipes/python_dbg_install.sh Outdated Show resolved Hide resolved
@mdemoret-nv
Copy link
Contributor

@gpucibot merge

@ghost ghost merged commit bd60e5d into nv-morpheus:branch-22.06 May 17, 2022
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Additional functionality added to an existing feature feature request New feature or request non-breaking Non-breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEA] Adding ability to build dev container with python debugging symbols / code.
3 participants