-
Notifications
You must be signed in to change notification settings - Fork 129
feat: update github workflows #407
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| #!/bin/bash | ||
| set -e | ||
|
|
||
| CONTAINER_NAME="${CONTAINER_NAME:-slurmctl}" | ||
| RPMBUILD_DIR="/root/rpmbuild" | ||
|
|
||
| usage() { | ||
| echo "Usage: $0 [-c container_name]" | ||
| echo " -c Container name (default: slurmctl)" | ||
| exit 1 | ||
| } | ||
|
|
||
| while getopts ":c:h" o; do | ||
| case "${o}" in | ||
| c) CONTAINER_NAME="${OPTARG}" ;; | ||
| h) usage ;; | ||
| *) usage ;; | ||
| esac | ||
| done | ||
|
|
||
| if ! docker inspect -f '{{.State.Running}}' "$CONTAINER_NAME" &>/dev/null; then | ||
| echo "Error: Container '$CONTAINER_NAME' is not running." | ||
| echo "Start it with: docker compose up -d" | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Wait for slurmctld to be ready | ||
| echo "Waiting for Slurm controller..." | ||
| for i in $(seq 1 30); do | ||
| if docker exec "$CONTAINER_NAME" scontrol ping 2>/dev/null | grep -q "UP"; then | ||
| echo "Slurm controller is ready." | ||
| break | ||
| fi | ||
| if [ "$i" -eq 30 ]; then | ||
| echo "Error: Slurm controller did not become ready in time." | ||
| exit 1 | ||
| fi | ||
| sleep 2 | ||
| done | ||
|
|
||
| echo "Installing RPM build dependencies in container '$CONTAINER_NAME'..." | ||
| docker exec "$CONTAINER_NAME" bash -c " | ||
| set -e | ||
| dnf install -y -q rpm-build python3-devel pyproject-rpm-macros \ | ||
| python3-Cython python3-setuptools python3-wheel | ||
| " | ||
|
|
||
| # Build sdist if not already present (may have been built by a prior CI step) | ||
| if ls dist/*.tar.gz &>/dev/null; then | ||
| echo "Using existing sdist in dist/" | ||
| else | ||
| echo "Building sdist..." | ||
| docker exec "$CONTAINER_NAME" bash -c " | ||
| set -e | ||
| pip install -q build | ||
| cd /pyslurm | ||
| python -m build --sdist | ||
| " | ||
| fi | ||
|
|
||
| echo "Building RPM..." | ||
| docker exec "$CONTAINER_NAME" bash -c " | ||
| set -e | ||
| mkdir -p ${RPMBUILD_DIR}/{BUILD,RPMS,SOURCES,SPECS,SRPMS} | ||
| cp /pyslurm/dist/*.tar.gz ${RPMBUILD_DIR}/SOURCES/ | ||
| cp /pyslurm/pyslurm.spec ${RPMBUILD_DIR}/SPECS/ | ||
| rpmbuild -ba ${RPMBUILD_DIR}/SPECS/pyslurm.spec | ||
| " | ||
|
|
||
| echo "Installing RPM in container '$CONTAINER_NAME'..." | ||
| docker exec "$CONTAINER_NAME" bash -c " | ||
| set -e | ||
| if rpm -q python3-pyslurm &>/dev/null; then | ||
| dnf reinstall -y -q ${RPMBUILD_DIR}/RPMS/*/python3-pyslurm-*.rpm | ||
| else | ||
| dnf install -y -q ${RPMBUILD_DIR}/RPMS/*/python3-pyslurm-*.rpm | ||
| fi | ||
| " | ||
|
|
||
| docker exec -i -w /tmp "$CONTAINER_NAME" python3 - << 'PYEOF' | ||
| import pyslurm | ||
| print("pyslurm version:", pyslurm.__version__) | ||
| from pyslurm import slurmctld | ||
| import pprint | ||
| conf = slurmctld.Config.load() | ||
| pprint.pprint(conf.to_dict()) | ||
| PYEOF | ||
|
|
||
| echo "RPM build and install successful." |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know when using scripts/build.sh setuptools was always complaining about those. Adding
pyslurm.slurmhere should still include it in thesdistthough right? (since its explicitly mentioned in MANIFEST.in). It just doesn't add those sources to the final installation dir I guess? (which is fine)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, both of these directories don’t have an
__init__.pyand only have Cython source files. The sdist does include these files since they are part of the source files needed to build the extension. Theexcludehere is so that these dirs don’t show up as importable Python packages, but they don’t have an__init__.pyanyway. So, this shouldn’t change behavior, just make it explicit, if i’m not mistaken.