@@ -19,13 +19,14 @@ dnf groupinstall "Development Tools" -y --exclude="texlive*"
1919dnf install -y memcached libmemcached-awesome-devel zlib-devel screen \
2020 openssl-devel bzip2-devel libffi-devel wget make xz-devel
2121# s
22- # Clone django-workload git repository
22+ # Copy django-workload from srcs directory instead of cloning from GitHub
2323mkdir -p " ${DJANGO_WORKLOAD_ROOT} "
2424pushd " ${DJANGO_WORKLOAD_ROOT} "
2525if ! [ -d " django-workload" ]; then
26- git clone https://github.com/facebookarchive/django-workload
26+ mkdir -p " django-workload"
27+ cp -r " ${DJANGO_PKG_ROOT} /srcs/django-workload/" * " django-workload/"
2728else
28- echo " [SKIPPED] cloning django-workload"
29+ echo " [SKIPPED] copying django-workload"
2930fi
3031
3132# Download pip third-party dependencies for django-workload
@@ -130,8 +131,10 @@ wget "https://files.pythonhosted.org/packages/11/35/575091de594677e40440a24be319
130131popd
131132unalias wget 2> /dev/null || echo " [Finished] downloading dependencies"
132133
133- # Copy run script w/ execute permissions
134- install -m755 -D " ${TEMPLATES_DIR} /run.sh" " ${DJANGO_WORKLOAD_ROOT} /bin/run.sh"
134+ # Copy bin directory from srcs
135+ mkdir -p " ${DJANGO_WORKLOAD_ROOT} /bin"
136+ cp -r " ${DJANGO_PKG_ROOT} /srcs/bin/" * " ${DJANGO_WORKLOAD_ROOT} /bin/"
137+ chmod +x " ${DJANGO_WORKLOAD_ROOT} /bin/" * .sh
135138
136139# 2. Install JDK
137140JDK_NAME=java-1.8.0-openjdk-devel
@@ -177,8 +180,8 @@ if ! [ -d Python-3.10.2 ]; then
177180 wget https://www.python.org/ftp/python/3.10.2/Python-3.10.2.tgz
178181 tar -xzf Python-3.10.2.tgz
179182 cd Python-3.10.2
180- ./configure --enable-optimizations
181- make altinstall
183+ ./configure --enable-optimizations --prefix= " $( pwd ) /python-build " --enable-shared LN= " ln -s "
184+ make install
182185 cd ../
183186fi
184187
@@ -187,54 +190,41 @@ if ! [ -d "cinder" ]; then
187190 git clone -b cinder/3.10 https://github.com/facebookincubator/cinder.git
188191 pushd cinder
189192 mkdir -p cinder-build
190- ./configure --prefix=" $( pwd) /cinder-build" --enable-optimizations
193+ ./configure --prefix=" $( pwd) /cinder-build" --enable-optimizations --enable-shared LN= " ln -s "
191194 make -j
192195 make install
193196 popd
194197fi
195198
196199# Create virtual environments for both CPython and Cinder
197200# Create CPython virtual env
198- [ ! -d venv_cpython ] && Python-3.10.2/python -m venv venv_cpython
201+ CPYTHON_INSTALL_PREFIX=" ${DJANGO_SERVER_ROOT} /Python-3.10.2/python-build"
202+ export LD_LIBRARY_PATH=" ${CPYTHON_INSTALL_PREFIX} /lib"
203+ [ ! -d venv_cpython ] && " ${CPYTHON_INSTALL_PREFIX} /bin/python3.10" -m venv venv_cpython
199204
200205# Create Cinder virtual env
201- [ ! -d venv_cinder ] && " ${DJANGO_SERVER_ROOT} /cinder/cinder-build/bin/python3" -m venv venv_cinder
206+ CINDER_INSTALL_PREFIX=" ${DJANGO_SERVER_ROOT} /cinder/cinder-build"
207+ export LD_LIBRARY_PATH=" ${CINDER_INSTALL_PREFIX} /lib"
208+ [ ! -d venv_cinder ] && " ${CINDER_INSTALL_PREFIX} /bin/python3" -m venv venv_cinder
202209
203210# Install packages in both virtual environments
204211# First, CPython environment
205212set +u
206213# shellcheck disable=SC1091
207214source ./venv_cpython/bin/activate
208215set -u
209- if ! [ -f setup.py.bak ]; then
210- # sed -i 's/django-cassandra-engine/django-cassandra-engine >= 1.6, < 1.9/' setup.py
211- sed -i ' /Django/s/.*//' setup.py
212- sed -i " /uwsgi/s/.*/ 'uwsgi',/" setup.py
213- cp setup.py setup.py.bak
214- fi
215-
216- cp setup.py.bak setup.py
217216
217+ export LD_LIBRARY_PATH=" ${CPYTHON_INSTALL_PREFIX} /lib"
218+ export CMAKE_LIBRARY_PATH=" ${CPYTHON_INSTALL_PREFIX} /lib"
219+ export CPATH=" ${DJANGO_SERVER_ROOT} /Python-3.10.2/python-build/include:${DJANGO_SERVER_ROOT} /Python-3.10.2/Include"
218220# Install dependencies using third_party pip dependencies
219221pip3.10 install " django-statsd-mozilla" --no-index --find-links file://" ${DJANGO_WORKLOAD_DEPS} "
220222pip3.10 install " numpy>=1.19" --no-index --find-links file://" ${DJANGO_WORKLOAD_DEPS} "
221223pip3.10 install -e . --no-index --find-links file://" ${DJANGO_WORKLOAD_DEPS} "
222224
223- # Configure Django and uWSGI
224- cp " ${TEMPLATES_DIR} /cluster_settings.py" " ${DJANGO_SERVER_ROOT} /cluster_settings.py.template" || exit 1
225- cp " ${TEMPLATES_DIR} /uwsgi.ini" " ${DJANGO_SERVER_ROOT} /uwsgi.ini" || exit 1
226- cp " ${TEMPLATES_DIR} /urls_template.txt" " ${DJANGO_REPO_ROOT} /client/urls_template.txt" || exit 1
227-
228- # Install the modified run-siege script
229- cp " ${TEMPLATES_DIR} /run-siege" " ${DJANGO_REPO_ROOT} /client/run-siege" || exit 1
225+ # No need to copy configuration files as they are already in the srcs directory
230226
231- # Patch for MLP and icache buster
232- # cltorres: Disable MLP patch. MLP implemented in Python does not work as intented due to bytecode abstraction
233- # git apply --check "${TEMPLATES_DIR}/django_mlp.patch" && git apply "${TEMPLATES_DIR}/django_mlp.patch"
234- pushd " ${DJANGO_REPO_ROOT} "
235- git apply --check " ${TEMPLATES_DIR} /django_genurl.patch" && git apply " ${TEMPLATES_DIR} /django_genurl.patch"
236- git apply --check " ${TEMPLATES_DIR} /django_libib.patch" && git apply " ${TEMPLATES_DIR} /django_libib.patch"
237- popd # ${DJANGO_REPO_ROOT}
227+ # No need to apply patches as the code in srcs already has the desired changes
238228
239229# Build oldisim icache buster library
240230set +u
@@ -255,34 +245,18 @@ if [ ! -f "${OUT}/django-workload/django-workload/libicachebuster.so" ]; then
255245 rm -rfv build/
256246fi
257247
258- pushd " ${BENCHPRESS_ROOT} "
259- # Patch for Java
260- git apply --check " ${TEMPLATES_DIR} /cassandra-env.patch" && git apply " ${TEMPLATES_DIR} /cassandra-env.patch"
261- git apply --check " ${TEMPLATES_DIR} /jvm_options.patch" && git apply " ${TEMPLATES_DIR} /jvm_options.patch"
248+ # Configure Java options directly
262249# shellcheck disable=SC2016
263250echo ' JVM_OPTS="$JVM_OPTS -Xss512k"' >> " ${DJANGO_WORKLOAD_ROOT} /apache-cassandra/conf/cassandra-env.sh"
264- # Patch for gen-urls-file
265- git apply --check " ${TEMPLATES_DIR} /gen-urls-file.patch" && git apply " ${TEMPLATES_DIR} /gen-urls-file.patch"
266- popd
267-
268- pushd " ${DJANGO_SERVER_ROOT} /django_workload"
269- # Patch for URLs
270- git apply --check " ${TEMPLATES_DIR} /urls.patch" && git apply " ${TEMPLATES_DIR} /urls.patch"
271251
272- # Apply Memcache tuning
273- git apply --check " ${TEMPLATES_DIR} /0002-Memcache-Tuning.patch" && git apply " ${TEMPLATES_DIR} /0002-Memcache-Tuning.patch"
274- # Apply db caching
275- git apply --check " ${TEMPLATES_DIR} /0003-bundle_tray_caching.patch" && git apply " ${TEMPLATES_DIR} /0003-bundle_tray_caching.patch"
276- # Remove duplicate middleware classes
277- git apply --check " ${TEMPLATES_DIR} /0004-del_dup_middleware_classes.patch" && git apply " ${TEMPLATES_DIR} /0004-del_dup_middleware_classes.patch"
278- # Enable Session, Authentication and Message middleware
279- git apply --check " ${TEMPLATES_DIR} /0005-django_middleware_settings.patch" && git apply " ${TEMPLATES_DIR} /0005-django_middleware_settings.patch"
280- popd
252+ # No need to copy template files as they are already in the srcs directory
281253
282254deactivate
283255
284256# Now install packages in Cinder environment
285257pushd " ${DJANGO_SERVER_ROOT} " # Make sure we're in the right directory
258+ export LD_LIBRARY_PATH=" ${CINDER_INSTALL_PREFIX} /lib"
259+ export CMAKE_LIBRARY_PATH=" ${CINDER_INSTALL_PREFIX} /lib"
286260export CPATH=" ${DJANGO_SERVER_ROOT} /cinder/cinder-build/include:${DJANGO_SERVER_ROOT} /cinder/Include"
287261source ./venv_cinder/bin/activate
288262set -u
0 commit comments