Skip to content

Commit

Permalink
Try an alternative fix for tensorflow/tensorflow/issues/30635 (#171)
Browse files Browse the repository at this point in the history
This copies the missing shared lib to a standard location. The fix is easier to deploy.

Copied from #170 with 1 cleanup.

I'll follow up with some tests which failed on TF 1.14
  • Loading branch information
jkbradley committed Sep 18, 2019
1 parent 77d6f21 commit 5e9da93
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 291 deletions.
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ ENV PATH $SPARK_HOME/bin:$PATH
ENV PYTHONPATH /opt/spark/python/lib/py4j-0.10.7-src.zip:/opt/spark/python/lib/pyspark.zip:$PYTHONPATH
ENV PYSPARK_PYTHON python

# Workaround for https://github.com/tensorflow/tensorflow/issues/30635.
RUN wget https://repo1.maven.org/maven2/org/tensorflow/libtensorflow_jni/1.14.0/libtensorflow_jni-1.14.0.jar && \
jar xf libtensorflow_jni-1.14.0.jar org/tensorflow/native/linux-x86_64/libtensorflow_framework.so.1 && \
mv org/tensorflow/native/linux-x86_64/libtensorflow_framework.so.1 /usr/lib && \
rm libtensorflow_jni-1.14.0.jar

# The tensorframes dir will be mounted here.
VOLUME /mnt/tensorframes
WORKDIR /mnt/tensorframes
Expand Down
20 changes: 2 additions & 18 deletions project/Build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,7 @@ object Shading extends Build {
ShadeRule.rename("com.google.protobuf.**" -> "org.tensorframes.protobuf3shade.@1").inAll,
ShadeRule.rename("google.protobuf.**" -> "org.tensorframes.google.protobuf3shade.@1").inAll
),
assemblyOption in assembly := (assemblyOption in assembly).value.copy(includeScala = false),
// TODO: `MergeStrategy.first` happens to overwrite the original files in the dependency. But it
// is not guaranteed by contract. We can explicitly remove the class from the dependency jar.
assemblyMergeStrategy in assembly := {
case PathList("org", "tensorflow", xs @ _*) => MergeStrategy.first
case x =>
val oldStrategy = (assemblyMergeStrategy in assembly).value
oldStrategy(x)
}
assemblyOption in assembly := (assemblyOption in assembly).value.copy(includeScala = false)
).settings(commonSettings: _*)
.enablePlugins(ProtobufPlugin)

Expand Down Expand Up @@ -139,15 +131,7 @@ object Shading extends Build {
assemblyShadeRules in assembly := Seq(
ShadeRule.rename("com.google.protobuf.**" -> "org.tensorframes.protobuf3shade.@1").inAll
),
assemblyOption in assembly := (assemblyOption in assembly).value.copy(includeScala = false),
// TODO: `MergeStrategy.first` happens to overwrite the original files in the dependency. But it
// is not guaranteed by contract. We can explicitly remove the class from the dependency jar.
assemblyMergeStrategy in assembly := {
case PathList("org", "tensorflow", xs @ _*) => MergeStrategy.first
case x =>
val oldStrategy = (assemblyMergeStrategy in assembly).value
oldStrategy(x)
}
assemblyOption in assembly := (assemblyOption in assembly).value.copy(includeScala = false)
).settings(commonSettings: _*)
.enablePlugins(ProtobufPlugin)
}
273 changes: 0 additions & 273 deletions src/main/scala/org/tensorflow/NativeLibrary.java

This file was deleted.

0 comments on commit 5e9da93

Please sign in to comment.