Skip to content

Add Continuous Integration + Review Requirements to CONTRIBUTING.md #7443

Closed

Description

@ahundt

Could some basic instructions and suggestions be added to CONTRIBUTING.md?

Example notes to add:

  • correctly installing and configuring a compliant python/C++ linter
  • links and explanation of other guidelines that must be followed
  • how to run tests on your own machine

Activity

  1. yaroslavvb commented on Feb 11, 2017

    @yaroslavvb
    Contributor

    I agree that it would be useful to community. I think perhaps someone who has recently gone through the process might be motivated to put the important things together into a nice guide.

    Some snippets from my development notes:

    making a PR: https://gist.github.com/yaroslavvb/bdb0a92f2a516ebbe2d386c48f5e2c45

    • license

    You must sign CLA agreement. See comments from Chris DiBona for why this license was chosen -- https://www.reddit.com/r/MachineLearning/comments/3s4qpm/google_tensorflow_released/

    If you created your commits with a wrong address (ie, default one git sets up), you have to rewrite your commit history to change your address to the one that corresponds to the one you signed CLA with. (github help pages a rewriting script that provded useful for this, https://help.github.com/articles/changing-author-info/)

    • pylint
    pip install pylint
    wget -O /tmp/pylintrc https://raw.githubusercontent.com/tensorflow/tensorflow/master/tensorflow/tools/ci_build/pylintrc
    pylint myfile.py --rcfile=/tmp/pylintrc
    
    • buildifier

    Install https://github.com/bazelbuild/buildifier and running it over the BUILD file to fix any formatting issues

    • clang format
      To see style corrections suggested by clang-format
    brew install clang-format
    clang-format tensorflow/stream_executor/cuda/cuda_diagnostics.cc --style=google > /tmp/cuda_diagnostics.cc
    diff tensorflow/stream_executor/cuda/cuda_diagnostics.cc /tmp/cuda_diagnostics.cc
    
    
    • Running tests

    Use bazel test. To see pip install requirements, check in tensorflow/tools/ci_build/install/install_pip_packages.sh

    Most recently this meant doing this

    pip install -I --upgrade setuptools
    pip install portpicker
    pip install mock
    pip install pep8
    pip install pylint
    pip install py-cpuinfo
    pip install pandas==0.18.1
    pip install wheel
    pip install --upgrade six==1.10.0
    pip install --upgrade werkzeug==0.11.10
    pip install --upgrade protobuf==3.0.0
    
    

    Then on Ubuntu:

    export LD_LIBRARY_PATH="/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64:$LD_LIBRARY_PATH"
    
    export flags="--config=opt --config=cuda -k"
    bazel test $flags //tensorflow/python/...
    

    On MacOS: (bazel needs to be explicitly told to pass env vars for some reason)

    export CUDA_HOME=/usr/local/cuda
    export DYLD_LIBRARY_PATH=/usr/local/cuda/lib:/usr/local/cuda/extras/CUPTI/lib
    export LD_LIBRARY_PATH=$DYLD_LIBRARY_PATH
    export PATH=$DYLD_LIBRARY_PATH:$PATH
    
    export flags="--config=cuda --config=opt -k --action_env PATH --action_env DYLD_LIBRARY_PATH --action_env LD_LIBRARY_PATH -k"
    bazel test $flags //tensorflow/python/...
    

    For changes to core framework
    bazel test $flags //tensorflow/...

    Keeping flags in $flags is important because if you you forget a flag, and do bazel run or bazel test with a new setting, it'll start building everything from scratch, aka 20+ mins of machine being semi-unresponsive.

    For long running tests, tmux is useful for provide robustness against disconnection/closing terminal:

    tmux new -s bazel -n 0
    bazel test //tensorflow/...
    
    

    Also, this to keep bazel from wiping its state overnight

    echo "startup --max_idle_secs=100000000" > ~/.bazelrc

    Also, some notes on general philosophy of contributions -- when you contribute something to TensorFlow, the maintenance burden is transferred to the Google TensorFlow team. This means that benefit of contribution must be compared against the cost of maintaining that feature until the heat death of universe.

    Hence there are cases when you want to extend functionality of TensorFlow, while remaining the owner/maintainer of this extension. This can be done by keeping extra functionality in a separate repo and using TensorFlow API to bring it in during runtime. For instance, new kernels/ops can be added to TensorFlow using TensorFlow plugin mechanism (load_library)

  2. ahundt commented on Feb 11, 2017

    @ahundt
    ContributorAuthor

    Awesome info! Since you mentioned tmux there is also http://byobu.co/ which is built on top of tmux and improves usability.

  3. aselle commented on Feb 15, 2017

    @aselle
    Contributor

    @ahundt, would you be willing to contribute a document to this effect? @gunan, do you have any other suggestions?

  4. added
    stat:awaiting response
    on Feb 15, 2017
  5. gunan commented on Feb 15, 2017

    @gunan
    Contributor

    One quick way to contribute would be to use our devel dockerfiles.
    But what is already mentioned sounds good to me.

  6. ahundt commented on Feb 15, 2017

    @ahundt
    ContributorAuthor

    @aselle I don't know all the policies at the moment that's why I asked, heh

  7. removed
    stat:awaiting response
    on Feb 15, 2017
  8. yaroslavvb commented on Feb 18, 2017

    @yaroslavvb
    Contributor

    I've added a couple of things (buildifier, clang-format) to original reply. I'll keep merging in extra things I come across in there until there's a better place

  9. ahundt commented on Feb 20, 2017

    @ahundt
    ContributorAuthor

    @yaroslavvb Could you just create a pull request directly adding the text to CONTRIBUTING.md?

    Regarding the folder of docker files, some of those scripts do look fairly straightforward and could be referenced:
    https://github.com/tensorflow/tensorflow/tree/master/tensorflow/tools/docker

  10. self-assigned this
    on Apr 28, 2017
  11. caisq commented on Apr 28, 2017

    @caisq
    Contributor

    FYI, we are working on the suggested improvements to CONTRIBUTING.md and possibly the docker files as well.

  12. ahundt commented on May 4, 2017

    @ahundt
    ContributorAuthor

    @vrv @caisq Thanks that guide looks super helpful!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

type:docs-bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions