-
Notifications
You must be signed in to change notification settings - Fork 66
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
Add script to test nightly environments are solvable and using recent nightlies. #690
Merged
Merged
Changes from 2 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
40ded38
Add script to test nightly environments are solvable and using recent…
bdice 551169f
Clean up script.
bdice d78a83f
Merge remote-tracking branch 'upstream/branch-24.10' into dry-run-nig…
bdice df6074e
Add test-conda-nightly-env to pr.yaml for testing.
bdice 98383f6
Skip build jobs for testing.
bdice d487411
Update RAPIDS_VERSION.
bdice 55da82b
Fix extension.
bdice 9d3a8b0
Exclude some packages, and collapse conda dry-run output.
bdice b323bfa
Use package name.
bdice c245fc6
Clean up.
bdice 4af2f57
Skip codecov.
bdice 0f4741f
Exclude pynvjitlink, fail on missing date strings, show package dates.
bdice d9478b4
Pretty-print dates.
bdice df76342
Use build workflow to get CPU runners and high matrix coverage.
bdice 26e4143
Improve formatting.
bdice 52c5308
Fix exclusions.
bdice 171644a
Fix warning for day-old packages.
bdice a27c3fc
Fix exclusion logic.
bdice 2a5c29c
Skip packages without dates.
bdice 4aeb2f5
Update colors.
bdice 15c2c9d
Improve formatting.
bdice 9b72086
Remove nx-cugraph.
bdice 925dd58
Re-enable PR builds of integration packages.
bdice ede8cf2
Add test workflow.
bdice f76b29a
Re-enable build job.
bdice 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 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,97 @@ | ||
import json | ||
import re | ||
import subprocess | ||
import sys | ||
from datetime import datetime, timedelta | ||
|
||
|
||
OLD_PACKAGE_THRESHOLD_DAYS = 3 | ||
|
||
|
||
def is_rapids_nightly_package(package_info): | ||
return package_info["channel"] == "rapidsai-nightly" | ||
|
||
|
||
def get_package_date(package): | ||
# Matches 6 digits starting with "2", which should be YYMMDD | ||
date_re = r"_(2\d{5})_" | ||
|
||
# Use regex to find the date string in the input | ||
match = re.search(date_re, package["build_string"]) | ||
|
||
if match: | ||
# Convert the date string to a datetime object | ||
date_string = match.group(1) | ||
date_object = datetime.strptime(date_string, "%y%m%d") | ||
return date_object | ||
|
||
print( | ||
f"Date string not found for {package['name']} " | ||
f"in the build string '{package['build_string']}'." | ||
) | ||
return None | ||
|
||
|
||
def check_env(json_path): | ||
"""Validate rapids conda environments. | ||
|
||
Parses JSON output of `conda create` and check the dates on the RAPIDS | ||
packages to ensure nightlies are relatively new. | ||
""" | ||
|
||
with open(json_path) as f: | ||
try: | ||
json_data = json.load(f) | ||
except ValueError as e: | ||
print("Error: JSON data file from conda failed to load:") | ||
print(e) | ||
sys.exit(1) | ||
|
||
if "error" in json_data: | ||
print("Error: conda failed:") | ||
print() | ||
print(json_data["error"]) | ||
sys.exit(1) | ||
|
||
package_data = json_data["actions"]["LINK"] | ||
|
||
rapids_package_data = list(filter(is_rapids_nightly_package, package_data)) | ||
|
||
# Dictionary to store the packages and their dates | ||
rapids_package_dates = { | ||
package["name"]: get_package_date(package) | ||
for package in rapids_package_data | ||
} | ||
|
||
today = datetime.now().replace(hour=0, minute=0, second=0, microsecond=0) | ||
old_threshold = today - timedelta(days=OLD_PACKAGE_THRESHOLD_DAYS) | ||
old_packages = { | ||
package: date | ||
for package, date in rapids_package_dates.items() | ||
if date is not None and date < old_threshold | ||
} | ||
|
||
# If there are old packages, raise an error | ||
if old_packages: | ||
print() | ||
print( | ||
"Error: The following nightly packages are more than " | ||
f"{OLD_PACKAGE_THRESHOLD_DAYS} days old:" | ||
) | ||
for package, date in old_packages.items(): | ||
date_string = date.strftime("%Y-%m-%d") | ||
print(f" - {package}: {date_string}") | ||
sys.exit(1) | ||
|
||
print(f"All packages are less than {OLD_PACKAGE_THRESHOLD_DAYS} days old.") | ||
|
||
|
||
if __name__ == "__main__": | ||
if len(sys.argv) != 2: | ||
print( | ||
"Provide only one argument, the filepath to a JSON output from " | ||
"conda." | ||
) | ||
sys.exit(1) | ||
|
||
check_env(sys.argv[1]) |
This file contains 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 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,29 @@ | ||
#!/bin/bash | ||
# Copyright (c) 2023, NVIDIA CORPORATION. | ||
|
||
set -euo pipefail | ||
|
||
RAPIDS_VERSION="23.12" | ||
CUDA_VERSION=${RAPIDS_CUDA_VERSION%.*} | ||
|
||
JSON_FILENAME="rapids_cuda${CUDA_VERSION}_py${RAPIDS_PY_VERSION}.json" | ||
|
||
echo "Creating conda environment with rapids=${RAPIDS_VERSION}, python=${RAPIDS_PY_VERSION}, cuda-version=${CUDA_VERSION}" | ||
#rapids-logger "Creating conda environment with rapids=${RAPIDS_VERSION}, python=${RAPIDS_PY_VERSION}, cuda-version=${CUDA_VERSION}" | ||
|
||
#rapids-conda-retry \ | ||
conda \ | ||
create \ | ||
--solver=libmamba \ | ||
-n rapids-${RAPIDS_VERSION} \ | ||
-c rapidsai-nightly \ | ||
-c conda-forge \ | ||
-c nvidia \ | ||
rapids=${RAPIDS_VERSION} \ | ||
python=${RAPIDS_PY_VERSION} \ | ||
cuda-version=${CUDA_VERSION} \ | ||
--dry-run \ | ||
--json \ | ||
| tee "${JSON_FILENAME}" | ||
|
||
python ci/check_conda_nightly_env.py "${JSON_FILENAME}" |
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.
(was going to put this as my review, realized a thread would probably be better)
I totally support adding something like this, based on your description offline:
But I don't think it offers 100% protection against the case described in https://github.com/rapidsai/ops/issues/2947.
That issue is not about just packages building against too-old versions of dependencies... it's about packages across RAPIDS building against very different versions of dependencies.
It looks to me that the code in this PR would catch cases like these:
rmm
nightlies haven't been published in the last 3 days"cugraph
andpylibraft
can't be installed in the same environment"These aren't captured by the existing nightly tests at https://github.com/rapidsai/workflows/actions/workflows/nightly-pipeline.yaml.
But this wouldn't be guaranteed to catch a case like this:
cuml
nightly built against anrmm
from 5 days ago, but the latestcudf
nightly built against anrmm
from yesterday"Because this test with the
rapids
package is solving across all of the packages' runtime dependencies, but they could have ended up building against older versions based on conflicts in their individual build environments, right?And those types of conflicts might not show up here if we use
pin_compatible(max_pin="x.x")
inrun
dependencies, e.g.pylibraft==24.10.*
is going to have a runtime dependency onrmm=24.10.*
regardless of which specific nightly ofrmm
it pulled in at build time. (pylibraft nightly files)I think detecting that other case would have to happen at build time (or by post-processing of logs from build time). And I don't know how complex that would be, so can't say with confidence that the complexity would be worth it.
I totally support the approach this PR is pursuing, just wanted to be sure to note this other possible avenue for version mismatches to get through.
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.
You are correct about what this will and will not cover. I think it's worth pursuing because (1) it prevents runtime problems from being hidden and (2) sometimes runtime conflicts will also affect build environments, so this may give us a bit of signal into deeper problems happening at build time, should they arise.
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.
Ok great! I totally support moving forward with this.