-
Notifications
You must be signed in to change notification settings - Fork 65
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
bokeh timeseries plots now comply with OpenMDAO's placement of recorder files. #1106
Merged
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
cb9dfa4
Updated bokeh timeseries reports to look for simulation and solution …
robfalck 7e9b918
timeseries plots now handle recordings not in the outputs directory.
robfalck 5591e01
more version checking
robfalck f9acd3f
more fixes
robfalck cf43b18
consistent version checking function added: dymos.utils.misc.om_version
robfalck 5a9c2b1
cleanup
robfalck 6fc466b
ignore line length in ipynb for now.
robfalck c1df410
add RUN_BUILD condition to workflow steps
swryan 9afcaf9
Build docs only against dev version of OpenMDAO for now
robfalck 845b145
cleanup
robfalck c5d7314
Fixed more issues with reading solution and simulation output files.
robfalck 4cf70f1
Notebook linting
robfalck e115c94
more linting
robfalck f4e684a
Fixes for tests which reference databases. Implemented use of om_vers…
robfalck 8e20d09
fixes for ruff failures in benchmarks
robfalck 27effff
Failing mpl test fix
robfalck 289b061
closer
robfalck a9b1c6e
cleanup logic for timeseries simulation output
robfalck d4c0c99
disable ruff preview for now
robfalck 3393ac6
last few tests under latest
robfalck 5d213a4
Last couple of failures on latest.
robfalck efda760
Merge remote-tracking branch 'swryan/workflow' into recorder_output_u…
robfalck 9518fd5
pep8
robfalck 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
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 |
---|---|---|
|
@@ -6,3 +6,11 @@ repos: | |
# Run the linter. | ||
- id: ruff | ||
types_or: [ python, pyi, jupyter ] | ||
- repo: local | ||
hooks: | ||
- id: check-notebook-outputs | ||
name: Check that notebooks have no output cells. | ||
description: Verifies that documentation notebooks contain no output cells. | ||
language: python | ||
pass_filenames: false | ||
entry: python ./docs/clean_notebooks.py --dryrun ./docs | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added to prevent accidentally commit of unclean notebooks. |
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
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
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,78 @@ | ||
#!/usr/bin/env python | ||
|
||
import argparse | ||
import json | ||
import os | ||
import pathlib | ||
import subprocess | ||
|
||
|
||
EXCLUDE_DIRS = ('_build', '.ipynb_checkpoints') | ||
|
||
|
||
class bcolors: | ||
FILE = '\033[96m' # blue | ||
CYAN = '\033[96m' | ||
GREEN = '\033[92m' | ||
WARNING = '\033[93m' | ||
FAIL = '\033[91m' | ||
ENDC = '\033[0m' | ||
BOLD = '\033[1m' | ||
UNDERLINE = '\033[4m' | ||
|
||
|
||
def _clear_notebook_outputs(path=os.getcwd(), dry_run=True): | ||
|
||
# Find all the notebooks | ||
notebooks = [] | ||
if pathlib.Path(path).is_dir(): | ||
for dirpath, dirs, files in os.walk(path, topdown=True): | ||
dirs[:] = [d for d in dirs if d not in EXCLUDE_DIRS] | ||
notebooks.extend(pathlib.Path(dirpath).glob('*.ipynb')) | ||
if not notebooks: | ||
print(f'{bcolors.FAIL}No notebooks found.{bcolors.ENDC}') | ||
return | ||
elif path.endswith('.ipynb'): | ||
notebooks.append(path) | ||
else: | ||
print(f'{bcolors.FILE}{path}{bcolors.ENDC}{bcolors.FAIL} is not a notebook file.{bcolors.ENDC}') | ||
return | ||
|
||
num_cleaned = 0 | ||
for file in notebooks: | ||
with open(file) as f: | ||
json_data = json.load(f) | ||
for i in json_data['cells']: | ||
if 'execution_count' in i and i['execution_count'] is not None: | ||
break | ||
else: | ||
# Notebook clean, process next notebook. | ||
continue | ||
num_cleaned += 1 | ||
if dry_run: | ||
print(f'Would clear outputs from {bcolors.FILE}{file}{bcolors.ENDC}. ' | ||
f'{bcolors.WARNING}(dryrun = True){bcolors.ENDC}') | ||
else: | ||
print(f'Clearing {bcolors.FILE}{file}{bcolors.ENDC}...', end='') | ||
subprocess.Popen(f"jupyter nbconvert --clear-output --inplace {file}", | ||
shell=True, | ||
stdout=subprocess.DEVNULL, | ||
stderr=subprocess.STDOUT).wait() | ||
print('done') | ||
|
||
if num_cleaned == 0: | ||
print('No unclean notebooks found.') | ||
|
||
return num_cleaned | ||
|
||
|
||
|
||
if __name__ == '__main__': | ||
parser = argparse.ArgumentParser(description='Clear notebook outputs in place.') | ||
parser.add_argument('path', nargs='?', default='.', help='The or directory path to clean.') | ||
parser.add_argument('-d', '--dryrun', action='store_true', | ||
help='Print notebooks with outputs but do not clean them.') | ||
args = parser.parse_args() | ||
num_cleaned = _clear_notebook_outputs(path=args.path, dry_run=args.dryrun) | ||
if num_cleaned >0 and args.dryrun: | ||
exit(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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Changed to dev to avoid backwards compatibility code in the documentation.