Skip to content

Commit

Permalink
Travis CI language: python (#429)
Browse files Browse the repository at this point in the history
* Travis CI language: python

* pip install flake8
  • Loading branch information
cclauss authored and tqchen committed Jul 16, 2018
1 parent 04cacd4 commit 99696ad
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 29 deletions.
41 changes: 21 additions & 20 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
# disable sudo to use container based build
sudo: false

# Enabling test on Linux and OS X
os:
- linux
- osx

# Use Build Matrix to do lint and build seperately
env:
matrix:
- TASK=lint
- TASK=unittest_gtest
group: travis_latest
language: python

matrix:
exclude:
- os: osx
env: TASK=lint
include:
- env: TASK=lint
os: linux
python: '3.6'
- env: TASK=unittest_gtest
os: linux
python: '3.6'
- env: TASK=unittest_gtest
language: ruby
os: osx

# dependent apt packages
addons:
Expand All @@ -30,18 +26,24 @@ addons:
- unzip
- gcc-4.8
- g++-4.8
- python3-pip

before_install:
- export TRAVIS=scripts/travis
- source ${TRAVIS}/travis_setup_env.sh
- ${TRAVIS}/travis_osx_install.sh

install:
- pip3 install --user cpplint pylint
- if [[ ${TRAVIS_OS_NAME} == "osx" ]]; then brew install python; fi
- python3 --version ; python3 -m pip --version
- python3 -m pip install cpplint pylint flake8

script: ${TRAVIS}/travis_script.sh
before_script:
# stop the build if there are Python syntax errors or undefined names
- flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
- flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics

script: ${TRAVIS}/travis_script.sh

before_cache:
- ${TRAVIS}/travis_before_cache.sh
Expand All @@ -50,7 +52,6 @@ cache:
directories:
- ${HOME}/.cache/usr


notifications:
# Emails are sent to the committer's git-configured email address by default,
email:
Expand Down
5 changes: 3 additions & 2 deletions scripts/lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def filepath_enumerate(paths):
out.append(os.path.normpath(os.path.join(root, name)))
return out

# pylint: disable=useless-object-inheritance
class LintHelper(object):
"""Class to help runing the lint and records summary"""

Expand Down Expand Up @@ -177,9 +178,9 @@ def main():
_HELPER.pylint_opts = ['--rcfile='+args.pylint_rc,]
file_type = args.filetype
allow_type = []
if file_type == 'python' or file_type == 'all':
if file_type in ('python', 'all'):
allow_type += [x for x in PYTHON_SUFFIX]
if file_type == 'cpp' or file_type == 'all':
if file_type in ('cpp', 'all'):
allow_type += [x for x in CXX_SUFFIX]
allow_type = set(allow_type)
if sys.version_info.major == 2 and os.name != 'nt':
Expand Down
8 changes: 4 additions & 4 deletions tracker/dmlc_tracker/mpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ def get_mpi_env(envs):
support both openmpi and mpich2
"""

cmd = ''
# windows hack: we will use msmpi
if sys.platform == 'win32':
for k, v in envs.items():
cmd += ' -env %s %s' % (k, str(v))
return cmd

# decide MPI version.
(out, err) = subprocess.Popen(['mpirun','--version'],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE).communicate()
cmd = ''
(out, err) = subprocess.Popen(['mpirun', '--version'],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE).communicate()
if b'Open MPI' in out:
for k, v in envs.items():
cmd += ' -x %s=%s' % (k, str(v))
Expand Down
6 changes: 3 additions & 3 deletions tracker/dmlc_tracker/slurm.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ def run(prog):
pass_envs['DMLC_JOB_CLUSTER'] = 'slurm'

if args.slurm_worker_nodes is None:
nworker_nodes = nworker
nworker_nodes = nworker
else:
nworker_nodes=args.slurm_worker_nodes


# start workers
if nworker > 0:
Expand All @@ -46,7 +46,7 @@ def run(prog):


if args.slurm_server_nodes is None:
nserver_nodes = nserver
nserver_nodes = nserver
else:
nserver_nodes=args.slurm_server_nodes

Expand Down

0 comments on commit 99696ad

Please sign in to comment.