-
Notifications
You must be signed in to change notification settings - Fork 3.8k
new environment vars for external druid and kafka + jupyter template #14592
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
Show all changes
4 commits
Select commit
Hold shift + click to select a range
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
129 changes: 129 additions & 0 deletions
129
examples/quickstart/jupyter-notebooks/notebooks/99-contributing/notebook-template.ipynb
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,129 @@ | ||
| { | ||
| "cells": [ | ||
| { | ||
| "cell_type": "markdown", | ||
| "id": "0cb3b009-ebde-4d56-9d59-a028d66d8309", | ||
| "metadata": {}, | ||
| "source": [ | ||
| "# Title\n", | ||
| "<!--\n", | ||
| " ~ Licensed to the Apache Software Foundation (ASF) under one\n", | ||
| " ~ or more contributor license agreements. See the NOTICE file\n", | ||
| " ~ distributed with this work for additional information\n", | ||
| " ~ regarding copyright ownership. The ASF licenses this file\n", | ||
| " ~ to you under the Apache License, Version 2.0 (the\n", | ||
| " ~ \"License\"); you may not use this file except in compliance\n", | ||
| " ~ with the License. You may obtain a copy of the License at\n", | ||
| " ~\n", | ||
| " ~ http://www.apache.org/licenses/LICENSE-2.0\n", | ||
| " ~\n", | ||
| " ~ Unless required by applicable law or agreed to in writing,\n", | ||
| " ~ software distributed under the License is distributed on an\n", | ||
| " ~ \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n", | ||
| " ~ KIND, either express or implied. See the License for the\n", | ||
| " ~ specific language governing permissions and limitations\n", | ||
| " ~ under the License.\n", | ||
| " -->\n", | ||
| "Introduction to Notebook\n", | ||
| "Lorem Ipsum" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "markdown", | ||
| "id": "bbdbf6ad-ca7b-40f5-8ca3-1070f4a3ee42", | ||
| "metadata": {}, | ||
| "source": [ | ||
| "## Prerequisites\n", | ||
| "\n", | ||
| "This tutorial works with Druid XX.0.0 or later.\n", | ||
| "\n", | ||
| "Launch this tutorial and all prerequisites using the `all-services` profile of the Docker Compose file for Jupyter-based Druid tutorials. For more information, see [Docker for Jupyter Notebook tutorials](https://druid.apache.org/docs/latest/tutorials/tutorial-jupyter-docker.html).\n" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "markdown", | ||
| "id": "7ee6aef8-a11d-48d5-bcdc-e6231ba594b7", | ||
| "metadata": {}, | ||
| "source": [ | ||
| "<details><summary> \n", | ||
| "<b>Run without Docker Compose</b> \n", | ||
| "</summary>\n", | ||
| "\n", | ||
| "In order to run this notebook you will need:\n", | ||
| "\n", | ||
| "<b>Required Services</b>\n", | ||
| "* <!-- include list of components needed for notebook, i.e. kafka, druid instance, etc. -->\n", | ||
| "\n", | ||
| "<b>Python packages</b>\n", | ||
| "* druidapi, a [Python client for Apache Druid](https://github.com/apache/druid/blob/master/examples/quickstart/jupyter-notebooks/druidapi/README.md)\n", | ||
| "* <!-- include any python package dependencies -->\n", | ||
| "</details>" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "markdown", | ||
| "id": "5007a243-b81a-4601-8f57-5b14940abbff", | ||
| "metadata": {}, | ||
| "source": [ | ||
| "### Initialization" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": null, | ||
| "id": "c1ec783b-df3f-4168-9be2-cdc6ad3e33c2", | ||
| "metadata": {}, | ||
| "outputs": [], | ||
| "source": [ | ||
| "import druidapi\n", | ||
| "import os\n", | ||
| "\n", | ||
| "if 'DRUID_HOST' not in os.environ.keys():\n", | ||
| " druid_host=f\"http://localhost:8888\"\n", | ||
| "else:\n", | ||
| " druid_host=f\"http://{os.environ['DRUID_HOST']}:8888\"\n", | ||
| " \n", | ||
| "print(f\"Opening a connection to {druid_host}.\")\n", | ||
| "druid = druidapi.jupyter_client(druid_host)" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": null, | ||
| "id": "c075de81-04c9-4b23-8253-20a15d46252e", | ||
| "metadata": {}, | ||
| "outputs": [], | ||
| "source": [ | ||
| "# INCLUDE THIS CELL IF YOUR NOTEBOOK USES KAFKA \n", | ||
| "# Use kafka_host variable when connecting to kafka \n", | ||
| "import os\n", | ||
| "\n", | ||
| "if 'KAFKA_HOST' not in os.environ.keys():\n", | ||
| " kafka_host=f\"http://localhost:9092\"\n", | ||
| "else:\n", | ||
| " kafka_host=f\"{os.environ['KAFKA_HOST']}:9092\"" | ||
| ] | ||
| } | ||
| ], | ||
| "metadata": { | ||
| "kernelspec": { | ||
| "display_name": "Python 3 (ipykernel)", | ||
| "language": "python", | ||
| "name": "python3" | ||
| }, | ||
| "language_info": { | ||
| "codemirror_mode": { | ||
| "name": "ipython", | ||
| "version": 3 | ||
| }, | ||
| "file_extension": ".py", | ||
| "mimetype": "text/x-python", | ||
| "name": "python", | ||
| "nbconvert_exporter": "python", | ||
| "pygments_lexer": "ipython3", | ||
| "version": "3.11.4" | ||
| } | ||
| }, | ||
| "nbformat": 4, | ||
| "nbformat_minor": 5 | ||
| } |
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.
Uh oh!
There was an error while loading. Please reload this page.