Skip to content

Commit

Permalink
Remove QPY generation venvs more eagerly
Browse files Browse the repository at this point in the history
Previously, the venv was only tidied up at the end of the script.  We
now have enough published versions of Qiskit that if a script fails its
QPY runs (and so exited before cleaning up its venv), we could overflow
the disk space allocated to the VM, and get no output from the job.
  • Loading branch information
jakelishman committed Mar 1, 2025
1 parent ffa3979 commit a4e1ef4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions test/qpy_compat/process_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,13 @@ if [[ ! -d $cache_dir ]] ; then
mkdir -p "$cache_dir"
pushd "$cache_dir"
echo "Generating QPY files with $package==$version"
"$venv_dir/bin/python" "${our_dir}/test_qpy.py" generate --version="$version"
# If the generation script fails, we still want to tidy up before exiting.
"$venv_dir/bin/python" "${our_dir}/test_qpy.py" generate --version="$version" || { rm -rf "$venv_dir"; exit 1; }
rm -rf "$venv_dir"
else
echo "Using cached QPY files for $version"
pushd "${cache_dir}"
fi
echo "Loading qpy files from $version with dev Qiskit"
"$python" "${our_dir}/test_qpy.py" load --version="$version"
popd
rm -rf "$venv_dir"

0 comments on commit a4e1ef4

Please sign in to comment.