Skip to content

Commit 12e83ab

Browse files
author
srikris
committed
Merge branch 'master' into gl-pickle-extensibility
Conflicts: oss_src/unity/python/sframe/test/test_gl_pickler.py
2 parents 80e154a + ea65a77 commit 12e83ab

102 files changed

Lines changed: 2527 additions & 3011 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
language: python
22
python:
33
- "2.7"
4+
- "3.4"
45
os:
56
- linux
67

configure

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
set -e
55
RELEASE_DIR=release
66
DEBUG_DIR=debug
7-
GRAPHLAB_HOME=$PWD
7+
GRAPHLAB_HOME=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
88
DEPS_PREFIX=$PWD/deps/local
99

1010
if [[ $OSTYPE == linux* ]]; then
@@ -57,6 +57,8 @@ function print_help {
5757
echo
5858
echo " --python_only Only run python dependency installation."
5959
echo
60+
echo " --python3 Use Python 3.4, default is Python 2.7."
61+
echo
6062
echo " --toolchain=[toolchain] Toolchain is either a dato-deps file on disk, "
6163
echo " or a URL to a toolchain. If toolchain is"
6264
echo " \"default\", a default one is selected"
@@ -96,8 +98,8 @@ function unknown_option {
9698
function run_cleanup {
9799
#!/bin/bash
98100
echo "cleaning up";
99-
rm -rf release debug deps cmake patches description.json
100-
rm -f *.tar.gz
101+
rm -rf release debug deps cmake patches description.json deps_version dummy.cpp miniconda.sh
102+
rm -f *.tar.gz
101103
}
102104

103105

@@ -162,6 +164,7 @@ while [ $# -gt 0 ]
162164
--yes) default_yes=1;;
163165
--cmake_only) cmake_only=1;;
164166
--python_only) python_only=1;;
167+
--python3) python3=1;;
165168
--R_integration) R_integration=1;;
166169
--help) print_help ;;
167170
-D) CFLAGS="$CFLAGS -D $2"; shift ;;
@@ -201,10 +204,20 @@ if [[ $python_only == 1 ]]; then
201204
run_cmake_configure=0
202205
fi
203206

207+
if [[ $python3 == 1 ]]; then
208+
CFLAGS="$CFLAGS -D PYTHON_VERSION=\"python3.4m\""
209+
PYTHON_VERSION="python3.4m"
210+
else
211+
CFLAGS="$CFLAGS -D PYTHON_VERSION=\"python2.7\""
212+
PYTHON_VERSION="python2.7"
213+
fi
204214

205215
if [[ $run_toolchain_install == 1 ]]; then
206216
run_cleanup
207-
./oss_local_scripts/install_python_toolchain.sh
217+
218+
cd ${GRAPHLAB_HOME}
219+
PYTHON_VERSION=${PYTHON_VERSION} ./oss_local_scripts/install_python_toolchain.sh
220+
208221
REMAINING_OPTIONS=$@
209222
if [[ $toolchain == default || $toolchain == "" ]]; then
210223
if [[ $OSTYPE == darwin* ]]; then
@@ -251,13 +264,12 @@ if [[ $OSTYPE == msys ]]; then
251264
CXX=g++.exe
252265
fi
253266
CMAKE=$PWD/deps/local/bin/cmake
267+
254268
LINKER=""
255269
if [ -e $PWD/deps/local/bin/ld.gold ]; then
256270
LINKER="-DCMAKE_LINKER=$PWD/deps/local/bin/ld.gold"
257271
elif [ -e $PWD/deps/local/bin/ld ]; then
258272
LINKER="-DCMAKE_LINKER=$PWD/deps/local/bin/ld"
259-
else
260-
LINKER=""
261273
fi
262274

263275
mkdir -p doc
@@ -292,9 +304,12 @@ if [[ $OSTYPE == msys ]]; then
292304
AR=`cygpath -m $AR`
293305
CFLAGS="$CFLAGS -D CMAKE_AR=$AR"
294306
# a bunch of stuff needed for python
295-
CFLAGS="$CFLAGS -D PYTHON_LIBRARY:FILEPATH=$PWD/deps/local/lib/python27.dll"
307+
if [[ $python3 == 1 ]]; then
308+
CFLAGS="$CFLAGS -D PYTHON_LIBRARY:FILEPATH=$PWD/deps/local/lib/python34.dll"
309+
else
310+
CFLAGS="$CFLAGS -D PYTHON_LIBRARY:FILEPATH=$PWD/deps/local/lib/python27.dll"
311+
fi
296312
CFLAGS="$CFLAGS -D PYTHON_EXECUTABLE:FILEPATH=$PWD/deps/conda/bin/python"
297-
CFLAGS="$CFLAGS -D PYTHON_INCLUDE_DIR:FILEPATH=$PWD/deps/local/include/python2.7"
298313
export PATH=$PATH:/mingw64/bin
299314
fi
300315
## ============================================================================

local_cmake/UseCython.cmake

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ mark_as_advanced( CYTHON_ANNOTATE CYTHON_NO_DOCSTRINGS CYTHON_FLAGS )
7373

7474
find_package( Cython REQUIRED )
7575
set(PYTHON_INCLUDE_DIR
76-
${CMAKE_SOURCE_DIR}/deps/local/include/python2.7)
76+
${CMAKE_SOURCE_DIR}/deps/local/include/${PYTHON_VERSION})
7777
set(PYTHON_LIBRARIES
78-
${CMAKE_SOURCE_DIR}/deps/local/lib/${CMAKE_SHARED_LIBRARY_PREFIX}python2.7${CMAKE_SHARED_LIBRARY_SUFFIX})
78+
${CMAKE_SOURCE_DIR}/deps/local/lib/${CMAKE_SHARED_LIBRARY_PREFIX}${PYTHON_VERSION}${CMAKE_SHARED_LIBRARY_SUFFIX})
7979
find_package( PythonLibs REQUIRED )
8080

8181

@@ -226,11 +226,16 @@ function( compile_pyx _name generated_file )
226226
list( REMOVE_DUPLICATES c_header_dependencies )
227227

228228
# Add the command to run the compiler.
229+
if (${PYTHON_VERSION} STREQUAL "python3.4m")
230+
set( ADDITIONAL_CYTHON_PARAM, "-3")
231+
else()
232+
set( ADDITIONAL_CYTHON_PARAM, "")
233+
endif()
229234
add_custom_command( OUTPUT ${_generated_file}
230235
COMMAND ${CYTHON_EXECUTABLE}
231236
ARGS ${cxx_arg} ${include_directory_arg}
232237
${annotate_arg} ${no_docstrings_arg} ${cython_debug_arg} ${CYTHON_FLAGS} ${cython_traceback}
233-
--output-file ${_generated_target_file} ${pyx_locations}
238+
${ADDITIONAL_CYTHON_PARAM} --output-file ${_generated_target_file} ${pyx_locations}
234239
DEPENDS ${pyx_locations} ${pxd_dependencies}
235240
IMPLICIT_DEPENDS ${pyx_lang} ${c_header_dependencies}
236241
COMMENT ${comment}
@@ -261,7 +266,7 @@ function( cython_add_module _name )
261266
# add_custom_target(${_name}_headers DEPENDS ${generated_file})
262267
python_add_module( ${_name} ${generated_file} ${other_module_sources} )
263268
if(WIN32)
264-
target_compile_definitions(${_name} PUBLIC MS_WIN64)
269+
target_compile_definitions(${_name} PUBLIC MS_WIN64)
265270
endif()
266271
if( APPLE )
267272
set_target_properties( ${_name} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup" )

oss_local_scripts/conda_requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ six==1.9.0
1818
tornado==4.1
1919
wheel==0.24.0
2020
statsmodels
21-
PIL
21+
pillow

oss_local_scripts/install_python_toolchain.sh

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ fi
2828
function windows_patch_python_header {
2929
if [[ $OSTYPE == msys ]]; then
3030
echo "#include <math.h>" > tmp
31-
cat deps/conda/include/python2.7/pyconfig.h >> tmp
32-
cp tmp deps/conda/include/python2.7/pyconfig.h
31+
cat deps/conda/include/${PYTHON_VERSION}/pyconfig.h >> tmp
32+
cp tmp deps/conda/include/${PYTHON_VERSION}/pyconfig.h
3333
rm tmp
3434
fi
3535
}
@@ -81,7 +81,11 @@ if [[ $haspython == 0 ]]; then
8181
cp $PWD/deps/conda/bin/*.dll $PWD/deps/conda/lib
8282
else
8383
if [ ! -e miniconda.sh ]; then
84-
download_file http://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh miniconda.sh
84+
if [[ ${PYTHON_VERSION} == "python3.4m" ]]; then
85+
download_file http://repo.continuum.io/miniconda/Miniconda3-3.16.0-Linux-x86_64.sh miniconda.sh
86+
else
87+
download_file http://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh miniconda.sh
88+
fi
8589
fi
8690
bash ./miniconda.sh -p $PWD/deps/conda -b
8791
fi
@@ -90,8 +94,8 @@ $python_scripts/conda install -y --file oss_local_scripts/conda_requirements.txt
9094
$python_scripts/pip install -r oss_local_scripts/pip_requirements.txt
9195
# for windows
9296
if [ -e deps/conda/bin/include ]; then
93-
mkdir -p deps/conda/include/python2.7
94-
cp deps/conda/bin/include/* deps/conda/include/python2.7
97+
mkdir -p deps/conda/include/${PYTHON_VERSION}
98+
cp deps/conda/bin/include/* deps/conda/include/${PYTHON_VERSION}
9599
fi
96100

97101
windows_patch_python_header
@@ -102,4 +106,4 @@ if [ $OSTYPE == "msys" ]; then
102106
else
103107
cp deps/conda/lib/libpython* deps/local/lib
104108
fi
105-
cp -R deps/conda/include/python2.7 deps/local/include
109+
cp -R deps/conda/include/${PYTHON_VERSION}/* deps/local/include

oss_local_scripts/make_egg.sh

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,6 @@ source ${WORKSPACE}/oss_local_scripts/python_env.sh $build_type
9393
# Windows specific
9494
archive_file_ext="tar.gz"
9595
if [[ $OSTYPE == msys ]]; then
96-
# C++ tests are default skipped on windows due to annoying issues around
97-
# unable to find libstdc++.dll which are not so easily fixable
98-
SKIP_CPP_TEST=1
9996
archive_file_ext="zip"
10097
unset PYTHONHOME
10198
fi
@@ -104,9 +101,17 @@ fi
104101
### Build the source with version number ###
105102
build_source() {
106103
echo -e "\n\n\n================= Build ${BUILD_NUMBER} ================\n\n\n"
104+
107105
# Configure
108106
cd ${WORKSPACE}
109-
./configure ${toolchain}
107+
108+
PY_MAJOR_VERSION=`python -V 2>&1 | perl -ne 'print m/^Python (\d)\.\d/'`
109+
if [[ $PY_MAJOR_VERSION == 3 ]]; then
110+
./configure ${toolchain} --python3
111+
else
112+
./configure ${toolchain}
113+
fi
114+
110115
# Make clean
111116
cd ${WORKSPACE}/${build_type}/oss_src/unity/python
112117
make oss_clean_python
@@ -115,8 +120,6 @@ build_source() {
115120
make -j${NUM_PROCS}
116121

117122
if [[ -z $SKIP_CPP_TEST ]]; then
118-
cd ${WORKSPACE}/oss_test
119-
touch $(find . -name "*.cxx")
120123
cd ${WORKSPACE}/${build_type}/oss_test
121124
make -j${NUM_PROCS}
122125
fi
@@ -222,7 +225,7 @@ package_egg() {
222225
if [[ $OSTYPE == darwin* ]] || [[ $OSTYPE == msys ]]; then
223226
dist_type="bdist_wheel"
224227
fi
225-
VERSION_NUMBER=`python -c "import sframe; print sframe.version"`
228+
VERSION_NUMBER=`python -c "import sframe; print(sframe.version)"`
226229
${PYTHON_EXECUTABLE} setup.py ${dist_type} # This produced an egg/wheel starting with SFrame-${VERSION_NUMBER} under dist/
227230

228231
cd ${WORKSPACE}
@@ -236,7 +239,12 @@ package_egg() {
236239
mv ${EGG_PATH} ${NEW_EGG_PATH}
237240
EGG_PATH=${NEW_EGG_PATH}
238241
elif [[ $OSTYPE == msys ]]; then
239-
EGG_PATH=${WORKSPACE}/${build_type}/oss_src/unity/python/dist/SFrame-${VERSION_NUMBER}-cp27-none-win_amd64.whl
242+
EGG_PATH=`ls ${WORKSPACE}/${build_type}/oss_src/unity/python/dist/SFrame-${VERSION_NUMBER}-*-none-win_amd64.whl`
243+
elif [[ $OSTYPE == linux-* ]]; then
244+
PYTHON_VERSION=`$PYTHON_EXECUTABLE -V 2>&1 | perl -ne 'print m/^Python (\d\.\d)/'`
245+
NEW_EGG_PATH=${WORKSPACE}/${build_type}/oss_src/unity/python/dist/SFrame-${VERSION_NUMBER}-py${PYTHON_VERSION}.${archive_file_ext}
246+
mv ${EGG_PATH} ${NEW_EGG_PATH}
247+
EGG_PATH=${NEW_EGG_PATH}
240248
fi
241249

242250
# Install the egg and do a sanity check
@@ -276,6 +284,7 @@ if [[ -z $SKIP_BUILD ]]; then
276284
build_source
277285
fi
278286

287+
set_build_number
279288

280289
if [[ -z $SKIP_CPP_TEST ]]; then
281290
cpp_test
@@ -285,12 +294,8 @@ if [[ -z $SKIP_TEST ]]; then
285294
unit_test
286295
fi
287296

288-
set_build_number
289-
290297
package_egg
291298

292299
if [[ -z $SKIP_DOC ]]; then
293300
generate_docs
294301
fi
295-
296-

oss_local_scripts/pip_requirements.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
awscli==1.6.2
22
httpretty==0.8.8
33
librato-metrics==0.8.2
4-
mixpanel==4.0.2
4+
mixpanel==4.2.0
55
moto==0.4.1
66
prettytable==0.7.2
7-
wsgiref==0.1.2
87
xmltodict==0.9.2
98
argparse==1.2.1
109
boto==2.33.0

oss_local_scripts/run_cpp_tests.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
for root, dirnames, filenames in os.walk('.'):
2525
for filename in fnmatch.filter(filenames, '*.cxxtest*'):
2626
matches.append(os.path.join(root, filename))
27-
print 'Found {} tests.'.format(len(matches))
27+
print('Found {} tests.'.format(len(matches)))
2828

2929
# Load the previous cache if it exists
3030
if os.path.exists(args.cache_file):
@@ -33,10 +33,10 @@
3333
cache = set()
3434

3535
if type(cache) != set:
36-
print "Invalid cache contents. Resetting cache"
36+
print("Invalid cache contents. Resetting cache")
3737
cache = set()
3838

39-
print 'Found {} files in cache.'.format(len(cache))
39+
print('Found {} files in cache.'.format(len(cache)))
4040

4141
# Hash each test binary.
4242
new_tests = {}
@@ -48,18 +48,18 @@
4848
hasher.update(buf)
4949
new_tests[test_file] = hasher.hexdigest()
5050
elapsed = time.time() - start_time
51-
print 'Hashed {0} files in {1} seconds.'.format(len(new_tests), elapsed)
51+
print('Hashed {0} files in {1} seconds.'.format(len(new_tests), elapsed))
5252

5353
# Make a list of tests whose hash does not appear in the cache
5454
tests = []
5555
for test_file in new_tests.keys():
5656
if new_tests[test_file] not in cache:
5757
tests.append(test_file)
58-
print 'Ready to test {} files.'.format(len(tests))
58+
print('Ready to test {} files.'.format(len(tests)))
5959

6060
# If there are no tests, pick a random one.
6161
if len(tests) == 0:
62-
print "For annoying reasons, we cannot handle running 0 tests because jenkins will complain. So we are running the first test"
62+
print("For annoying reasons, we cannot handle running 0 tests because jenkins will complain. So we are running the first test")
6363
tests = [matches[0]]
6464

6565
# Get basename and use .cxx rather than .cxxtest
@@ -68,16 +68,17 @@
6868
# Make the command to run
6969
cmd = 'ctest -j {0} --schedule-random -R "({1})"'.format(args.j, '|'.join(runtests))
7070
if args.dry_run:
71-
print 'Dry run requested! Proposed ctest command:', cmd
71+
print('Dry run requested! Proposed ctest command:', cmd)
7272
exit()
7373

7474
exit_code = 0
7575
try:
7676
ctest_output = subprocess.check_output(cmd, shell=True)
77-
except subprocess.CalledProcessError, e:
77+
except subprocess.CalledProcessError as e:
7878
ctest_output = e.output
7979
exit_code = e.returncode
80-
print ctest_output
80+
ctest_output = ctest_output.decode()
81+
print(ctest_output)
8182
# get all the lines which say "Passed"
8283
lines = [line for line in ctest_output.splitlines() if "Passed" in line]
8384
# go through all the tests and see if we have a "Passed" line matching it

oss_local_scripts/run_python_test.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ fi
1515
BUILD_TYPE=$1
1616
SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
1717
cd ${SCRIPT_DIR}/..
18-
oss_local_scripts/install_python_toolchain.sh
1918
source oss_local_scripts/python_env.sh $BUILD_TYPE
2019

2120
# Make nosetest prints unity server log on exception

oss_src/lambda/graph_pylambda_master.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,10 @@ void graph_pylambda_master::shutdown_instance() {
3333
}
3434

3535
graph_pylambda_master::graph_pylambda_master(size_t nworkers) {
36-
std::vector<std::string> worker_addresses;
37-
for (size_t i = 0; i < nworkers; ++i) {
38-
worker_addresses.push_back(std::string("ipc://") + get_temp_name());
39-
}
4036
m_worker_pool.reset(
4137
new worker_pool<graph_lambda_evaluator_proxy>(
4238
nworkers,
43-
lambda_master::get_lambda_worker_binary(),
44-
worker_addresses));
39+
lambda_master::get_lambda_worker_binary()));
4540

4641
if (nworkers < thread::cpu_count()) {
4742
logprogress_stream << "Using default " << nworkers << " lambda workers.\n";

0 commit comments

Comments
 (0)