-
Notifications
You must be signed in to change notification settings - Fork 7
Health check script #60
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
Draft
evawoodbridge
wants to merge
8
commits into
gradient-ai:main
Choose a base branch
from
graphcore:health_check_script
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
5abc087
Initial script
evawoodbridge c7a891e
parse settings.yaml file
evawoodbridge 23b26e0
Extract check files exist function
evawoodbridge ddd3710
Use logger
evawoodbridge 2d588d0
Add metadata file checking
evawoodbridge 45d82ee
Merge branch 'gradient-ai:main' into health_check_script
evawoodbridge 058f025
Adding main function
evawoodbridge 26b7672
Merge branch 'health_check_script' of github.com:graphcore/Graphcore-…
evawoodbridge 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
from pathlib import Path | ||
import subprocess | ||
import json | ||
import os | ||
import yaml | ||
import logging | ||
from examples_utils.paperspace_utils.dataset_upload_checker import check_files_match_metadata | ||
|
||
def check_files_exist(files: [str], dirname: str): | ||
dirpath = Path(dirname) | ||
sub_directories = [str(f) for f in dirpath.iterdir() if f.is_dir()] | ||
for filename in files: | ||
full_path = str(dirpath/filename) | ||
if full_path not in sub_directories: | ||
logging.warning(filename + " not found in " + dirname) | ||
else: | ||
dataset_sub_directories = [str(f) for f in Path(full_path).iterdir()] | ||
if full_path+"/gradient_dataset_metadata.json" in dataset_sub_directories: | ||
check_files_match_metadata(full_path,False) | ||
else: | ||
logging.warning("Metadata file not found in "+ full_path) | ||
|
||
#Check that the number of detected IPUs is correct | ||
def check_num_pod_expected(logger:logging.Logger): | ||
pod_type = os.getenv("GRAPHCORE_POD_TYPE") | ||
expected_ipu_num = pod_type.replace("pod","") | ||
|
||
num_ipus = os.getenv("NUM_AVAILABLE_IPU", "0") | ||
|
||
if expected_ipu_num != num_ipus: | ||
logger.warning("Incorrect number of IPUs found "+ num_ipus+" expected "+ expected_ipu_num) | ||
else: | ||
logger.info("Correct number IPUs found") | ||
|
||
def main(): | ||
logger = logging.getLogger() | ||
logger.setLevel(logging.INFO) | ||
# Check that the datasets have mounted as expected | ||
|
||
# Gather the datasets expected from the settings.yaml | ||
with open("settings.yaml") as f: | ||
my_dict = yaml.safe_load(f) | ||
datasets = my_dict["integrations"].keys() | ||
|
||
# Check that dataset exists and if a metadata file is found check that all files in the metadata file exist | ||
check_files_exist(datasets, "./datasets") | ||
|
||
# Check that files are symlinked correctly - this needs to be manually edited for each runtime | ||
expected_exe_cache = ["fine-tuning-bert", "kge_training"] | ||
check_files_exist(expected_exe_cache, "/tmp/exe_cache") | ||
|
||
main() |
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.
It be good to add a
main
function which clearly breaks down the steps but this seems on the right track