Skip to content

Commit

Permalink
Update tensorboard to 2.16.2 (microsoft#8942)
Browse files Browse the repository at this point in the history
  • Loading branch information
rikenm1 authored Apr 29, 2024
1 parent 119c40d commit 4b9fed8
Show file tree
Hide file tree
Showing 7 changed files with 110 additions and 34 deletions.
12 changes: 12 additions & 0 deletions SPECS/python-tensorboard/0000-Use-system-package.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff -urN tensorboard-2.16.2/tensorboard/pip_package/build_pip_package.sh tensorboard-2.16.2/tensorboard/pip_package/build_pip_package.sh
--- tensorboard-2.16.2/tensorboard/pip_package/build_pip_package.sh 2024-04-29 08:54:07.635971311 -0700
+++ tensorboard-2.16.2/tensorboard/pip_package/build_pip_package.sh 2024-04-29 08:55:27.281331937 -0700
@@ -103,8 +103,6 @@

virtualenv -q -p python3 venv
export VIRTUAL_ENV=venv
- export PATH="${PWD}/venv/bin:${PATH}"
- unset PYTHON_HOME

# Require wheel for bdist_wheel command, and setuptools 36.2.0+ so that
# env markers are handled (https://github.com/pypa/setuptools/pull/1081)
50 changes: 50 additions & 0 deletions SPECS/python-tensorboard/dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Three things important for creating the cache
# i) Bazel version should match .bazelversion file
# ii) The Working directory should match the directory where this cache will be used.
# for example: In AZL3.0 tensorflow is built in "/usr/src/azl/BUILD/tensorflow-$version".
# iii) Python version should match the version in caching phase and the build phase

FROM mcr.microsoft.com/cbl-mariner/base/core:2.0

ARG TB_VERSION

WORKDIR /root/
# RUN tdnf -y install createrepo
# COPY RPMS /opt/rpms
# COPY custom.repo /etc/yum.repos.d

# COPY toolchain_rpms /opt/rpms
# RUN createrepo /opt/rpms
#bazel version must match with the .bazelversion
RUN tdnf -y install build-essential git tar bazel python3-devel python3-numpy python3-pip python3-wheel python3-six python3-setuptools python3-virtualenv python3-protobuf python3-absl-py gcc zlib wget ca-certificates
RUN tdnf -y install which python3-werkzeug
# Create Working Directory
RUN wget https://github.com/tensorflow/tensorboard/archive/refs/tags/$TB_VERSION.tar.gz
RUN mkdir -p /usr/src/azl/BUILD
RUN tar -xvf $TB_VERSION.tar.gz -C /usr/src/azl/BUILD
WORKDIR /usr/src/azl/BUILD/tensorboard-$TB_VERSION
RUN ln -s /usr/bin/python3 /usr/bin/python

RUN bazel --output_user_root=./tb_tmp fetch //tensorboard/pip_package:build_pip_package
# As compiling start we exit the command. This indicates all the dependencies has been downloaded
# should take 5-10 mins
RUN bazel --output_user_root=./tb_tmp build //tensorboard/pip_package:build_pip_package > /tmp/bazel_output.log 2>&1 & \
pid=$! && \
while true; do \
if grep -q "Compiling" /tmp/bazel_output.log; then \
echo "Compiling detected, exiting..." && \
kill $pid && \
exit 0; \
fi; \
sleep 1; \
done


# clean up any compiled code
RUN bazel clean

WORKDIR /usr/src/azl/BUILD
RUN tar -czf tensorboard-$TB_VERSION.tar.gz tensorboard-$TB_VERSION
RUN mv tensorboard-$TB_VERSION.tar.gz /root

CMD ["bash"]
14 changes: 14 additions & 0 deletions SPECS/python-tensorboard/genereate_source_tarball.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

# output = tensorboard-$TB_VERSION.tar.gz
# Tensorboard version to use
TB_VERSION="2.16.2"

docker build --build-arg TB_VERSION=$TB_VERSION -t tensorboard .

CONTAINER_ID=$(docker run -d tensorboard)

docker cp $CONTAINER_ID:/root/tensorboard-$TB_VERSION.tar.gz $PWD

docker stop $CONTAINER_ID
docker rm $CONTAINER_ID
5 changes: 2 additions & 3 deletions SPECS/python-tensorboard/python-tensorboard.signatures.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"Signatures": {
"python-tensorboard-2.11.0.tar.gz": "4045f3eca77ef335dcd70879ff9aecc2d2ba09e3fb5f39e501f868b4ab23c2b2",
"python-tensorboard-2.11.0-cache.tar.gz": "77b35869c63fc15b5cdeeff3dc6ac472e79a62739a69537bf60a38fa902b66a4"
"python-tensorboard-2.16.2.tar.gz": "9e69ad2243289a82500547271a213a4ee7a8be89fdebdd87372dac953e61b834"
}
}
}
53 changes: 25 additions & 28 deletions SPECS/python-tensorboard/python-tensorboard.spec
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,31 @@ TensorBoard is a suite of web applications for inspecting and understanding your

Summary: TensorBoard is a suite of web applications for inspecting and understanding your TensorFlow runs and graphs
Name: python-%{pypi_name}
Version: 2.11.0
Release: 4%{?dist}
Version: 2.16.2
Release: 1%{?dist}
License: ASL 2.0
Vendor: Microsoft Corporation
Distribution: Azure Linux
URL: https://github.com/tensorflow/tensorboard
Source0: https://github.com/tensorflow/tensorboard/archive/refs/tags/%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1: %{name}-%{version}-cache.tar.gz
BuildRequires: python3-setuptools
BuildRequires: python3-pip
BuildRequires: python3-wheel
BuildRequires: python3-six
# This source also contains the dependencies required for building tensorboard
Source0: %{_distro_sources_url}/%{name}-%{version}.tar.gz#/%{name}-%{version}.tar.gz

Patch0: 0000-Use-system-package.patch
BuildRequires: bazel
BuildRequires: gcc
BuildRequires: build-essential
BuildRequires: protobuf
BuildRequires: zlib
BuildRequires: gcc
BuildRequires: git
BuildRequires: python3-absl-py
BuildRequires: python3-numpy
BuildRequires: python3-pip
BuildRequires: python3-protobuf
BuildRequires: python3-setuptools
BuildRequires: python3-six
BuildRequires: python3-virtualenv
BuildRequires: python3-wheel
BuildRequires: python3-werkzeug
BuildRequires: which
BuildRequires: zlib
ExclusiveArch: x86_64


Expand Down Expand Up @@ -56,32 +63,19 @@ Summary: %{summary}
%autosetup -p1 -n tensorboard-%{version}

%build
tar -xf %{SOURCE1} -C /root/

ln -s /usr/bin/python3 /usr/bin/python

ln -s %{_bindir}/python3 %{_bindir}/python
#tensorboard-data-server
pushd tensorboard/data/server/pip_package
python3 setup.py -q bdist_wheel
popd
mkdir -p pyproject-wheeldir/ && cp tensorboard/data/server/pip_package/dist/*.whl pyproject-wheeldir/

#tensorboard built using bazel
bazel --batch build //tensorboard/pip_package:build_pip_package
#cache
# ---------
# steps to create the cache tar. network connection is required to create the cache.
#----------------------------------
# bazel clean
# pushd /root
# tar -czvf %{name}-%{version}-cache.tar.gz .cache #creating the cache using the /root/.cache directory
# popd
# mv /root/%{name}-%{version}-cache.tar.gz /usr/

#tensorboard package build script build_pip_package.sh doesn't assign RUNFILES variable successfully.
sed -i 's/output="$1"/output="$1"\n \ RUNFILES="$(CDPATH="" cd -- "$0.runfiles" \&\& pwd)"/' bazel-bin/tensorboard/pip_package/build_pip_package
#tb_tmp contains all the dependencies for bazel build
bazel --batch --output_user_root=./tb_tmp build //tensorboard/pip_package:build_pip_package
bazel-bin/tensorboard/pip_package/build_pip_package .
mv %{pypi_name}-%{version}-*.whl pyproject-wheeldir/
mv %{pypi_name}-*.whl pyproject-wheeldir/

%install
%{pyproject_install}
Expand All @@ -100,6 +94,9 @@ mv %{pypi_name}-%{version}-*.whl pyproject-wheeldir/
%{python3_sitelib}/tensorboard_data_server*

%changelog
* Thu Apr 25 2024 Riken Maharjan <rmaharjan@microsoft.com> - 2.16.2-1
- Upgrade tensorboard to 2.16.2.

* Tue Apr 23 2024 Andrew Phelps <anphel@microsoft.com> - 2.11.0-4
- Remove missing requirements `python3-tf-nightly` and `python3-tensorflow-estimator`

Expand Down
6 changes: 5 additions & 1 deletion SPECS/tensorflow/tensorflow.spec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Summary: TensorFlow is an open source machine learning framework for everyone.
Name: tensorflow
Version: 2.16.1
Release: 1%{?dist}
Release: 3%{?dist}
License: ASL 2.0
Vendor: Microsoft Corporation
Distribution: Azure Linux
Expand Down Expand Up @@ -49,6 +49,7 @@ Requires: python3-requests
Requires: python3-setuptools
Requires: python3-six
Requires: python3-termcolor
Requires: python3-tensorboard
Requires: python3-typing-extensions
Requires: python3-wrapt

Expand Down Expand Up @@ -91,6 +92,9 @@ bazel --batch build //tensorflow/tools/pip_package:build_pip_package
%{_bindir}/toco_from_protos

%changelog
* Mon Apr 29 2024 Riken Maharjan <rmaharjan@microsoft> - 2.16.1-3
- Add tensorboard as runtime requirement

* Wed Mar 27 2024 Riken Maharjan <rmaharjan@microsoft> - 2.16.1-2
- Remove Unnecessary requirements and add keras as runtime req

Expand Down
4 changes: 2 additions & 2 deletions cgmanifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -24533,8 +24533,8 @@
"type": "other",
"other": {
"name": "python-tensorboard",
"version": "2.11.0",
"downloadUrl": "https://github.com/tensorflow/tensorboard/archive/refs/tags/2.11.0.tar.gz"
"version": "2.16.2",
"downloadUrl": "https://cblmarinerstorage.blob.core.windows.net/sources/core/python-tensorboard-2.16.2.tar.gz"
}
}
},
Expand Down

0 comments on commit 4b9fed8

Please sign in to comment.