-
Notifications
You must be signed in to change notification settings - Fork 834
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
fix: binder runtime issues #1598
fix: binder runtime issues #1598
Conversation
Hey @ppruthi 👋! |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
Codecov Report
@@ Coverage Diff @@
## master #1598 +/- ##
==========================================
- Coverage 83.68% 82.30% -1.39%
==========================================
Files 310 292 -18
Lines 15823 15473 -350
Branches 752 752
==========================================
- Hits 13242 12735 -507
- Misses 2581 2738 +157
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
"if platform == \"binder\":\n", | ||
" from IPython import get_ipython\n", | ||
"\n", | ||
" !pip install matplotlib Pillow\n", |
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.
should we put these libraries in the binder image?
"platform = current_platform()\n", | ||
"if platform == \"synapse\":\n", |
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 its a PITA but can we replace all of the places in the notebooks where we have this silly project arcadia thing?
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.
Yep - that was the plan -- wanted to see if this works fine and does not regress on E2E tests
return "binder" | ||
else: | ||
return "unknown" | ||
|
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.
We might also want to add a findSecret API that will run through the gambit of looking in keyvaults, using databricks methods, and checking env vars before yelling and asking someone to replace that line with their key if they cant find anything
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
def CurrentPlatform(): | ||
if os.environ.get("AZURE_SERVICE", None) == "Microsoft.ProjectArcadia": | ||
return PLATFORM_SYNAPSE | ||
elif "dbfs" in os.listdir("/"): | ||
return PLATFORM_DATABRICKS | ||
elif os.environ.get("BINDER_LAUNCH_HOST", None) is not None: | ||
return PLATFORM_BINDER | ||
else: | ||
return PLATFORM_UNKNOWN | ||
|
||
|
||
def RunningOnSynapse(): | ||
if CurrentPlatform() is PLATFORM_SYNAPSE: | ||
return True | ||
return False | ||
|
||
|
||
def RunningOnBinder(): | ||
if CurrentPlatform() is PLATFORM_BINDER: | ||
return True | ||
return False | ||
|
||
|
||
def RunningOnDatabricks(): | ||
if CurrentPlatform() is PLATFORM_DATABRICKS: | ||
return True | ||
return False | ||
|
||
|
||
def PrintKeyWarning(): |
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.
nit: use snake_case here
|
||
|
||
def PrintKeyWarning(): | ||
if not RunningOnSynapse(): |
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.
nit, throw an error here and refactor this to try to find a secret in a few places
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
raise RuntimeError( | ||
"#### Please add your environment/service specific key(s) before running the notebook ####" | ||
) from None | ||
return "" |
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.
raise RuntimeError( | |
"#### Please add your environment/service specific key(s) before running the notebook ####" | |
) from None | |
return "" | |
raise RuntimeError(f"Could not find {secret_name} in keyvault or overrides. If you are running this demo and would like to manually specify your key please add the override="YOUR_KEY_HERE" to the arguments of the find_secret method") | |
) |
return current_platform() is PLATFORM_DATABRICKS | ||
|
||
|
||
def get_platform_specific_secret(searchKey): |
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.
def get_platform_specific_secret(searchKey): | |
def find_secret(secret_name, keyvault=SECRET_STORE, override=None): |
|
||
spark = SparkSession.builder.getOrCreate() | ||
dbutils = DBUtils(spark) | ||
return dbutils.secrets.get(scope=SECRET_STORE, key=searchKey) |
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.
return dbutils.secrets.get(scope=SECRET_STORE, key=searchKey) | |
return dbutils.secrets.get(scope=keyvault, key=secret_name) |
if running_on_synapse(): | ||
from notebookutils.mssparkutils.credentials import getSecret | ||
|
||
return getSecret(SECRET_STORE, searchKey) |
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.
return getSecret(SECRET_STORE, searchKey) | |
return getSecret(keyvault, secret_name) |
3122307
to
c67cfb0
Compare
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
c67cfb0
to
20c3744
Compare
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
Related Issues/PRs
A few notebooks have runtime failures while running on mybinder.org. This PR fixes those issues.
What changes are proposed in this pull request?
Modifying jupyter notebooks in
$REPO_ROOT/notebooks/features
to run on mybinder.org as well as our test infrastrucuture.How is this patch tested?
Our CI infra + manually running notebooks on mybinder.org
Does this PR change any dependencies?
Does this PR add a new feature? If so, have you added samples on website?
website/docs/documentation
folder.Make sure you choose the correct class
estimators/transformers
and namespace.DocTable
points to correct API link.yarn run start
to make sure the website renders correctly.<!--pytest-codeblocks:cont-->
before each python code blocks to enable auto-tests for python samples.WebsiteSamplesTests
job pass in the pipeline.AB#1914413