Integrate stackdriver support with tensorflow (roll forward cl/315012368)

PiperOrigin-RevId: 316580813
Change-Id: I93a66821fd13dc24a45c47f3e67638aed81d59be
This commit is contained in:
A. Unique TensorFlower 2020-06-15 17:35:30 -07:00 committed by TensorFlower Gardener
parent 4ac4683f5e
commit c34265b348
6 changed files with 50 additions and 4 deletions

View File

@ -200,6 +200,8 @@ build:nogcp --define=no_gcp_support=true
build:nohdfs --define=no_hdfs_support=true
build:nonccl --define=no_nccl_support=true
build:stackdriver_support --define=stackdriver_support=true
build --define=use_fast_cpp_protos=true
build --define=allow_oversize_protos=true

View File

@ -298,6 +298,13 @@ config_setting(
visibility = ["//visibility:public"],
)
# Experimental features
config_setting(
name = "stackdriver_support",
define_values = {"stackdriver_support": "true"},
visibility = ["//visibility:public"],
)
# Crosses between platforms and file system libraries not supported on those
# platforms due to limitations in nested select() statements.
config_setting(

View File

@ -100,7 +100,7 @@ load("//tensorflow:tensorflow.bzl", "tf_cc_test_gpu")
load("//tensorflow:tensorflow.bzl", "tf_cc_tests_gpu")
# buildifier: disable=same-origin-load
load("//tensorflow:tensorflow.bzl", "tf_monitoring_deps")
load("//tensorflow:tensorflow.bzl", "tf_monitoring_framework_deps")
# For platform specific build config
load(
@ -1950,7 +1950,7 @@ cc_library(
"@zlib",
"@double_conversion//:double-conversion",
"@com_google_protobuf//:protobuf",
] + tf_protos_all_impl() + tf_protos_grappler_impl() + tf_protos_profiler_impl() + tf_monitoring_deps(),
] + tf_protos_all_impl() + tf_protos_grappler_impl() + tf_protos_profiler_impl() + tf_monitoring_framework_deps(),
# Alwayslink causes a cc_binary to "always link" in the
# srcs for a given cc_library, even if they are unreferenced, see:
# https://docs.bazel.build/versions/master/be/c-cpp.html#cc_library.alwayslink

View File

@ -5,6 +5,9 @@
load("//tensorflow:tensorflow.bzl", "py_strict_library")
load("//tensorflow:tensorflow.bzl", "cc_header_only_library", "if_mlir", "if_not_windows", "if_xla_available", "py_test", "py_tests", "tf_cc_shared_object", "tf_cuda_library", "tf_gen_op_wrapper_py")
# buildifier: disable=same-origin-load
load("//tensorflow:tensorflow.bzl", "tf_monitoring_python_deps")
# buildifier: disable=same-origin-load
load("//tensorflow:tensorflow.bzl", "tf_python_pybind_extension")
@ -6048,6 +6051,7 @@ pywrap_tensorflow_macro(
"//tensorflow/core/util/tensor_bundle",
"//tensorflow/compiler/mlir/python:mlir",
] + (tf_additional_lib_deps() +
tf_monitoring_python_deps() +
tf_additional_plugin_deps() +
tf_additional_profiler_deps()) + if_ngraph([
"@ngraph_tf//:ngraph_tf",

View File

@ -2864,8 +2864,31 @@ def if_cuda_or_rocm(if_true, if_false = []):
"//conditions:default": if_false,
})
def tf_monitoring_deps():
return []
def tf_monitoring_framework_deps(link_to_tensorflow_framework = True):
"""Get the monitoring libs that will be linked to the tensorflow framework.
Currently in OSS, the protos must be statically linked to the tensorflow
framework, whereas the grpc should not be linked here.
"""
return select({
"//tensorflow:stackdriver_support": [
"@com_github_googlecloudplatform_tensorflow_gcp_tools//monitoring:stackdriver_exporter_protos",
],
"//conditions:default": [],
})
def tf_monitoring_python_deps():
"""Get the monitoring libs that will be linked to the python wrapper.
Currently in OSS, the grpc must be statically linked to the python wrapper
whereas the protos should not be linked here.
"""
return select({
"//tensorflow:stackdriver_support": [
"@com_github_googlecloudplatform_tensorflow_gcp_tools//monitoring:stackdriver_exporter",
],
"//conditions:default": [],
})
def tf_jit_compilation_passes_extra_deps():
return []

View File

@ -351,6 +351,16 @@ def tf_repositories(path_prefix = "", tf_repo_name = ""):
],
)
tf_http_archive(
name = "com_github_googlecloudplatform_tensorflow_gcp_tools",
sha256 = "5e9ebe17eaa2895eb7f77fefbf52deeda7c4b63f5a616916b823eb74f3a0c542",
strip_prefix = "tensorflow-gcp-tools-2643d8caeba6ca2a6a0b46bb123953cb95b7e7d5",
urls = [
"https://storage.googleapis.com/mirror.tensorflow.org/github.com/GoogleCloudPlatform/tensorflow-gcp-tools/archive/2643d8caeba6ca2a6a0b46bb123953cb95b7e7d5.tar.gz",
"https://github.com/GoogleCloudPlatform/tensorflow-gcp-tools/archive/2643d8caeba6ca2a6a0b46bb123953cb95b7e7d5.tar.gz",
],
)
tf_http_archive(
name = "com_google_googleapis",
build_file = clean_dep("//third_party/googleapis:googleapis.BUILD"),