5dc8ce0b357983add2bc0979de1b87b92579509a,tests/integ/test_local_mode.py,,test_mxnet_local_data_local_script,#,339

Before Change




def test_mxnet_local_data_local_script():
    local_mode_lock_fd = open(LOCK_PATH, "w")
    local_mode_lock = local_mode_lock_fd.fileno()

    data_path = os.path.join(DATA_DIR, "mxnet_mnist")
    script_path = os.path.join(data_path, "mnist_framework_mode.py")

    mx = MXNet(entry_point=script_path, role="SageMakerRole",
               train_instance_count=1, train_instance_type="local",
               sagemaker_session=LocalNoS3Session())

    train_input = "file://" + os.path.join(data_path, "train")
    test_input = "file://" + os.path.join(data_path, "test")

    mx.fit({"train": train_input, "test": test_input})
    endpoint_name = mx.latest_training_job.name
    try:
        // Since Local Mode uses the same port for serving, we need a lock in order
        // to allow concurrent test execution. The serving test is really fast so it still
        // makes sense to allow this behavior.
        fcntl.lockf(local_mode_lock, fcntl.LOCK_EX)
        predictor = mx.deploy(1, "local", endpoint_name=endpoint_name)
        data = numpy.zeros(shape=(1, 1, 28, 28))
        predictor.predict(data)
    finally:
        mx.delete_endpoint()
        time.sleep(5)
        fcntl.lockf(local_mode_lock, fcntl.LOCK_UN)


def test_local_transform_mxnet(sagemaker_local_session, tmpdir, mxnet_full_version):
    local_mode_lock_fd = open(LOCK_PATH, "w")
    local_mode_lock = local_mode_lock_fd.fileno()
    data_path = os.path.join(DATA_DIR, "mxnet_mnist")

After Change


    mx.fit({"train": train_input, "test": test_input})
    endpoint_name = mx.latest_training_job.name

    with local_mode_utils.lock():
        try:
            predictor = mx.deploy(1, "local", endpoint_name=endpoint_name)
            data = numpy.zeros(shape=(1, 1, 28, 28))
            predictor.predict(data)
        finally:
            mx.delete_endpoint()


def test_local_transform_mxnet(sagemaker_local_session, tmpdir, mxnet_full_version):
    data_path = os.path.join(DATA_DIR, "mxnet_mnist")
    script_path = os.path.join(data_path, "mnist.py")
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 8

Non-data size: 12

Instances


Project Name: aws/sagemaker-python-sdk
Commit Name: 5dc8ce0b357983add2bc0979de1b87b92579509a
Time: 2018-12-07
Author: jonathan.esterhazy@gmail.com
File Name: tests/integ/test_local_mode.py
Class Name:
Method Name: test_mxnet_local_data_local_script


Project Name: aws/sagemaker-python-sdk
Commit Name: 5dc8ce0b357983add2bc0979de1b87b92579509a
Time: 2018-12-07
Author: jonathan.esterhazy@gmail.com
File Name: tests/integ/test_local_mode.py
Class Name:
Method Name: test_tf_distributed_local_mode


Project Name: aws/sagemaker-python-sdk
Commit Name: 5dc8ce0b357983add2bc0979de1b87b92579509a
Time: 2018-12-07
Author: jonathan.esterhazy@gmail.com
File Name: tests/integ/test_local_mode.py
Class Name:
Method Name: test_local_mode_serving_from_s3_model


Project Name: aws/sagemaker-python-sdk
Commit Name: 5dc8ce0b357983add2bc0979de1b87b92579509a
Time: 2018-12-07
Author: jonathan.esterhazy@gmail.com
File Name: tests/integ/test_local_mode.py
Class Name:
Method Name: test_tf_local_mode


Project Name: aws/sagemaker-python-sdk
Commit Name: 5dc8ce0b357983add2bc0979de1b87b92579509a
Time: 2018-12-07
Author: jonathan.esterhazy@gmail.com
File Name: tests/integ/test_local_mode.py
Class Name:
Method Name: test_tf_local_data


Project Name: aws/sagemaker-python-sdk
Commit Name: 5dc8ce0b357983add2bc0979de1b87b92579509a
Time: 2018-12-07
Author: jonathan.esterhazy@gmail.com
File Name: tests/integ/test_local_mode.py
Class Name:
Method Name: test_local_mode_serving_from_local_model


Project Name: aws/sagemaker-python-sdk
Commit Name: 5dc8ce0b357983add2bc0979de1b87b92579509a
Time: 2018-12-07
Author: jonathan.esterhazy@gmail.com
File Name: tests/integ/test_local_mode.py
Class Name:
Method Name: test_mxnet_local_mode


Project Name: aws/sagemaker-python-sdk
Commit Name: 5dc8ce0b357983add2bc0979de1b87b92579509a
Time: 2018-12-07
Author: jonathan.esterhazy@gmail.com
File Name: tests/integ/test_local_mode.py
Class Name:
Method Name: test_tf_local_data_local_script