Skip to content

Do not run tensorflow integ tests when running python 3. #374

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

Merged
merged 4 commits into from
Sep 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions tests/integ/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@

import logging
import os
import sys

DATA_DIR = os.path.join(os.path.dirname(__file__), '..', 'data')
TRAINING_DEFAULT_TIMEOUT_MINUTES = 20
TUNING_DEFAULT_TIMEOUT_MINUTES = 20
PYTHON_VERSION = 'py' + str(sys.version_info.major)

logging.getLogger('boto3').setLevel(logging.INFO)
logging.getLogger('botocore').setLevel(logging.INFO)
6 changes: 5 additions & 1 deletion tests/integ/test_local_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from sagemaker.mxnet import MXNet, MXNetModel
from sagemaker.tensorflow import TensorFlow
from sagemaker.fw_utils import tar_and_upload_dir
from tests.integ import DATA_DIR
from tests.integ import DATA_DIR, PYTHON_VERSION
from tests.integ.timeout import timeout

DATA_PATH = os.path.join(DATA_DIR, 'iris', 'data')
Expand Down Expand Up @@ -75,6 +75,7 @@ def mxnet_model(sagemaker_local_session):
return model


@pytest.mark.skipif(PYTHON_VERSION != 'py2', reason="TensorFlow image supports only python 2.")
def test_tf_local_mode(tf_full_version, sagemaker_local_session):
local_mode_lock_fd = open(LOCK_PATH, 'w')
local_mode_lock = local_mode_lock_fd.fileno()
Expand Down Expand Up @@ -120,6 +121,7 @@ def test_tf_local_mode(tf_full_version, sagemaker_local_session):
fcntl.lockf(local_mode_lock, fcntl.LOCK_UN)


@pytest.mark.skipif(PYTHON_VERSION != 'py2', reason="TensorFlow image supports only python 2.")
def test_tf_distributed_local_mode(sagemaker_local_session):
local_mode_lock_fd = open(LOCK_PATH, 'w')
local_mode_lock = local_mode_lock_fd.fileno()
Expand Down Expand Up @@ -164,6 +166,7 @@ def test_tf_distributed_local_mode(sagemaker_local_session):
fcntl.lockf(local_mode_lock, fcntl.LOCK_UN)


@pytest.mark.skipif(PYTHON_VERSION != 'py2', reason="TensorFlow image supports only python 2.")
def test_tf_local_data(sagemaker_local_session):
local_mode_lock_fd = open(LOCK_PATH, 'w')
local_mode_lock = local_mode_lock_fd.fileno()
Expand Down Expand Up @@ -206,6 +209,7 @@ def test_tf_local_data(sagemaker_local_session):
fcntl.lockf(local_mode_lock, fcntl.LOCK_UN)


@pytest.mark.skipif(PYTHON_VERSION != 'py2', reason="TensorFlow image supports only python 2.")
def test_tf_local_data_local_script():
local_mode_lock_fd = open(LOCK_PATH, 'w')
local_mode_lock = local_mode_lock_fd.fileno()
Expand Down
5 changes: 4 additions & 1 deletion tests/integ/test_tf.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import pytest

from sagemaker.tensorflow import TensorFlow
from tests.integ import DATA_DIR, TRAINING_DEFAULT_TIMEOUT_MINUTES
from tests.integ import DATA_DIR, TRAINING_DEFAULT_TIMEOUT_MINUTES, PYTHON_VERSION
from tests.integ.timeout import timeout_and_delete_endpoint_by_name, timeout
from tests.integ.vpc_utils import get_or_create_subnet_and_security_group

Expand All @@ -27,6 +27,7 @@


@pytest.mark.continuous_testing
@pytest.mark.skipif(PYTHON_VERSION != 'py2', reason="TensorFlow image supports only python 2.")
def test_tf(sagemaker_session, tf_full_version):
with timeout(minutes=TRAINING_DEFAULT_TIMEOUT_MINUTES):
script_path = os.path.join(DATA_DIR, 'iris', 'iris-dnn-classifier.py')
Expand Down Expand Up @@ -60,6 +61,7 @@ def test_tf(sagemaker_session, tf_full_version):
assert dict_result == list_result


@pytest.mark.skipif(PYTHON_VERSION != 'py2', reason="TensorFlow image supports only python 2.")
def test_tf_async(sagemaker_session):
with timeout(minutes=TRAINING_DEFAULT_TIMEOUT_MINUTES):
script_path = os.path.join(DATA_DIR, 'iris', 'iris-dnn-classifier.py')
Expand Down Expand Up @@ -89,6 +91,7 @@ def test_tf_async(sagemaker_session):
print('predict result: {}'.format(result))


@pytest.mark.skipif(PYTHON_VERSION != 'py2', reason="TensorFlow image supports only python 2.")
def test_failed_tf_training(sagemaker_session, tf_full_version):
with timeout(minutes=TRAINING_DEFAULT_TIMEOUT_MINUTES):
script_path = os.path.join(DATA_DIR, 'iris', 'failure_script.py')
Expand Down
3 changes: 2 additions & 1 deletion tests/integ/test_tf_cifar.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import pytest

from sagemaker.tensorflow import TensorFlow
from tests.integ import DATA_DIR
from tests.integ import DATA_DIR, PYTHON_VERSION
from tests.integ.timeout import timeout_and_delete_endpoint_by_name, timeout

PICKLE_CONTENT_TYPE = 'application/python-pickle'
Expand All @@ -34,6 +34,7 @@ def __call__(self, data):


@pytest.mark.continuous_testing
@pytest.mark.skipif(PYTHON_VERSION != 'py2', reason="TensorFlow image supports only python 2.")
def test_cifar(sagemaker_session, tf_full_version):
with timeout(minutes=45):
script_path = os.path.join(DATA_DIR, 'cifar_10', 'source')
Expand Down
3 changes: 2 additions & 1 deletion tests/integ/test_tf_keras.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@
import pytest

from sagemaker.tensorflow import TensorFlow
from tests.integ import DATA_DIR
from tests.integ import DATA_DIR, PYTHON_VERSION
from tests.integ.timeout import timeout_and_delete_endpoint_by_name, timeout


@pytest.mark.continuous_testing
@pytest.mark.skipif(PYTHON_VERSION != 'py2', reason="TensorFlow image supports only python 2.")
def test_keras(sagemaker_session, tf_full_version):
script_path = os.path.join(DATA_DIR, 'cifar_10', 'source')
dataset_path = os.path.join(DATA_DIR, 'cifar_10', 'data')
Expand Down
3 changes: 2 additions & 1 deletion tests/integ/test_tuner.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
from sagemaker.pytorch import PyTorch
from sagemaker.tensorflow import TensorFlow
from sagemaker.tuner import IntegerParameter, ContinuousParameter, CategoricalParameter, HyperparameterTuner
from tests.integ import DATA_DIR, TUNING_DEFAULT_TIMEOUT_MINUTES
from tests.integ import DATA_DIR, PYTHON_VERSION, TUNING_DEFAULT_TIMEOUT_MINUTES
from tests.integ.record_set import prepare_record_set_from_local_files
from tests.integ.timeout import timeout, timeout_and_delete_endpoint_by_name

Expand Down Expand Up @@ -218,6 +218,7 @@ def test_tuning_mxnet(sagemaker_session):


@pytest.mark.continuous_testing
@pytest.mark.skipif(PYTHON_VERSION != 'py2', reason="TensorFlow image supports only python 2.")
def test_tuning_tf(sagemaker_session):
with timeout(minutes=TUNING_DEFAULT_TIMEOUT_MINUTES):
script_path = os.path.join(DATA_DIR, 'iris', 'iris-dnn-classifier.py')
Expand Down