Skip to content
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

Add option for build more python tests in Cmake #11853

Merged
merged 18 commits into from
Aug 11, 2017

Conversation

raymondxyang
Copy link

  • Add option tensorflow_BUILD_MORE_PYTHON_TESTS for testing some major packages under contrib directory
  • Tested, fixed and enabled some UTs on Windows/Linux

@tensorflow-jenkins
Copy link
Collaborator

Can one of the admins verify this patch?

@rmlarsen
Copy link
Member

rmlarsen commented Aug 8, 2017

@mrry could you take a look at this, please?

@rmlarsen rmlarsen added the awaiting review Pull request awaiting review label Aug 8, 2017
@raymondxyang
Copy link
Author

Thanks @rmlarsen @mrry

Copy link
Contributor

@mrry mrry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for improving the test coverage! Some comments and questions about the changes follow....

@@ -148,14 +148,28 @@ if (tensorflow_BUILD_PYTHON_TESTS)
"${tensorflow_source_dir}/tensorflow/python/training/*_test.py"
"${tensorflow_source_dir}/tensorflow/contrib/data/*_test.py"
"${tensorflow_source_dir}/tensorflow/contrib/factorization/*_test.py"
"${tensorflow_source_dir}/tensorflow/contrib/keras/python/keras/integration_test.py"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this test failing? It would be better to leave it here if not, so that it continues to be part of our presubmits...

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AssertionError on local Windows build (GPU) recorded when committed. Passed latest Jenkins tensorflow/master build (CPU).. So I will add it back since Jenkins only run CPU build

@@ -195,7 +195,7 @@ def func_dump(func):
Returns:
A tuple `(code, defaults, closure)`.
"""
code = marshal.dumps(func.__code__).decode('raw_unicode_escape')
code = marshal.dumps(func.__code__).replace(b'\\',b'/').decode('raw_unicode_escape')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's going on here? It doesn't seem generally safe to do this, but I'm not familiar with this code...

constants.COLLECTION_DEF_KEY_FOR_INPUT_FEATURE_KEYS))
self.assertItemsEqual(
['bogus_lookup', 'feature'],
[x.decode("utf-8") for x in graph.get_collection(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this work on Python 2.x with non-Unicode strings?

It might be better to use the compat.py conversion functions to canonicalize these to bytes (or str) objects....

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@@ -63,32 +63,33 @@ def _get_default_signature(self, export_meta_filename):
signatures_any[0].Unpack(signatures)
default_signature = signatures.default_signature
return default_signature

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the linter will complain about the added space here and on L85... delete it, please.

def _assert_export(self, export_monitor, export_dir, expected_signature):
self.assertTrue(gfile.Exists(export_dir))
# Only the written checkpoints are exported.
self.assertTrue(
saver.checkpoint_exists(export_dir + '00000001/export'),
saver.checkpoint_exists(os.path.join( export_dir, '00000001', 'export')),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete the space after join( here and on L73, L75, and L77.

self.assertFalse(saver.checkpoint_exists(export_dir + '00000000/export'))
self.assertTrue(saver.checkpoint_exists(export_dir + '00000010/export'))
# Catch exception for non-existing path
# with self.assertRaises(errors.NotFoundError):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete this commented-out line.

# Validate the signature
signature = self._get_default_signature(export_dir + '00000010/export.meta')
signature = self._get_default_signature(
os.path.join( export_dir, '00000010', 'export.meta'))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete the space after join(.

compat.as_str_any(path.path))
# Modify the path object for RegEx match for Windows Paths
match = re.match("^" + compat.as_str_any(base_dir).replace('\\','/') + "/(\\d+)$",
compat.as_str_any(path.path).replace('\\','/'))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This substitution doesn't seem safe on POSIX... what if there is a \ character in a path? Perhaps you should guard this with an if os.name == 'nt': block.

@@ -301,7 +301,8 @@ def export(self,
if exports_to_keep:
# create a simple parser that pulls the export_version from the directory.
def parser(path):
match = re.match("^" + export_dir_base + "/(\\d{8})$", path.path)
match = re.match("^" + export_dir_base.replace('\\','/') + "/(\\d{8})$",
path.path.replace('\\','/'))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as before... wrap this in an if os.name == 'nt': block.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All regex fixed.. thanks for the advice Derek

@rmlarsen rmlarsen added stat:awaiting response Status - Awaiting response from author and removed awaiting review Pull request awaiting review labels Aug 9, 2017
@rmlarsen
Copy link
Member

rmlarsen commented Aug 9, 2017

@tensorflow-jenkins test this please

Copy link
Contributor

@mrry mrry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for the contribution!

@raymondxyang
Copy link
Author

Hi @mrry
As I check the jennkins i found failure message as below:

//tensorflow/contrib/keras:core_test                                     FAILED in 6.9s
  /var/lib/jenkins/workspace/tensorflow-pull-requests-cpu/bazel-ci_build-cache/.cache/bazel/_bazel_jenkins/eab0d61a99b6696edb3d2aff87b585e8/execroot/workspace/bazel-out/local-opt/testlogs/tensorflow/contrib/keras/core_test/test.log

Executed 1182 out of 1182 tests: 1181 tests pass and 1 fails locally.

Parameterized build ends with FAILURE at: Wed Aug  9 18:35:12 UTC 2017 (Elapsed time: 2116 s)
Build step 'Execute shell' marked build as failure
[Set GitHub commit status (universal)] ERROR on repos [] (sha:19cad03) with context:tensorflow-pull-requests-cpu
Unable to get pull request builder trigger!!
Setting status of 49e83b063f14167577fdd440950ecba22db8a36a to FAILURE with url https://ci.tensorflow.org/job/tensorflow-pull-requests-cpu/6245/ and message: 'FAILURE
 '
Using context: Linux CPU Tests
Finished: FAILURE

Not sure what happened.. and cannot re-produce on local/own jennkins bazel build.. would you help me look into the log or help me getting the detailed info?

@rmlarsen
Copy link
Member

@tensorflow-jenkins test this please
@raymondxyang the failure you saw was most likely a tool failure unrelated to your PR.

@raymondxyang
Copy link
Author

Hi @rmlarsen I've added a missing module related to the failure. May I have it re-tested by jenkins?
Thanks again for following up the request J

@mrry
Copy link
Contributor

mrry commented Aug 10, 2017

@tensorflow-jenkins test this please.

@raymondxyang
Copy link
Author

The test tensorflow/python/training/server_lib_test.py started but never finished.. killed for over time limit. touched nothing related to it and it passed in the previous Windows run both locally and on the jenkins.. Can jenkins re-test it? Thanks J

@rmlarsen
Copy link
Member

@tensorflow-jenkins test this please

1 similar comment
@rmlarsen
Copy link
Member

@tensorflow-jenkins test this please

@rmlarsen
Copy link
Member

Thanks for the contribution!

@rmlarsen rmlarsen merged commit 9f81374 into tensorflow:master Aug 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes stat:awaiting response Status - Awaiting response from author
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants