-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This should really be two commits but it's late. Updates contributors and people using Hamilton. Updates the slack example giving it a README and a notebook.
- Loading branch information
Showing
4 changed files
with
118 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Slack notifier example | ||
|
||
This example demonstrates how to use the Slack notifier. | ||
|
||
Fill in the details in `slack_notification_example.py` and then | ||
run it `python slack_notification_example.py`. You should see a message in your Slack channel. |
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,98 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "initial_id", | ||
"metadata": { | ||
"collapsed": true | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"!pip install \"sf-hamilton[slack]\"" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"outputs": [], | ||
"source": [ | ||
"import pandas as pd\n", | ||
"\n", | ||
"from hamilton import driver\n", | ||
"from hamilton.plugins.h_slack import SlackNotifier\n", | ||
"\n", | ||
"# load magic\n", | ||
"%load_ext hamilton.plugins.jupyter_magic" | ||
], | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"id": "e88039e484e64415" | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"outputs": [], | ||
"source": [ | ||
"%%cell_to_module -m example_module\n", | ||
"def test_function() -> pd.DataFrame:\n", | ||
" raise Exception(\"test exception\")\n", | ||
" return pd.DataFrame({\"a\": [1, 2, 3], \"b\": [4, 5, 6]})" | ||
], | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"id": "444cc24511d338a3" | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"outputs": [], | ||
"source": [ | ||
"# SLACK DETAILS FOR YOU TO FILL IN\n", | ||
"api_key = \"YOUR_API_KEY\"\n", | ||
"channel = \"YOUR_CHANNEL\"" | ||
], | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"id": "98b516f88f03981c" | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"outputs": [], | ||
"source": [ | ||
"dr = (\n", | ||
" driver.Builder()\n", | ||
" .with_modules(example_module)\n", | ||
" .with_adapters(SlackNotifier(api_key=api_key, channel=channel))\n", | ||
" .build()\n", | ||
")\n", | ||
"print(dr.execute([\"test_function\"]))" | ||
], | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"id": "48fdfb26417eeb26" | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 2 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython2", | ||
"version": "2.7.6" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
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 @@ | ||
sf-hamilton[slack] |