Skip to content

Commit

Permalink
Update sdk_and_flows.ipynb
Browse files Browse the repository at this point in the history
  • Loading branch information
haochenpan committed Jul 9, 2024
1 parent 2635e54 commit d4110eb
Showing 1 changed file with 37 additions and 4 deletions.
41 changes: 37 additions & 4 deletions examples/sdk_and_flows.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,36 @@
" trigger_configs, invoke_configs))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### List created triggers"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"'''\n",
" List all triggered created by the user.\n",
" Note: the print function below highlights the trigger name, \n",
" handler name, uuid, and topic it taps on.\n",
" expected return:\n",
" trigger name: ... trigger handler name: ... \n",
" trigger uuid: ... trigger topic: ...\n",
"'''\n",
"\n",
"for function in c.list_triggers()['triggers']:\n",
" print('trigger name:', function['function_name'], '\\n',\n",
" 'trigger handler name:',\n",
" function['function_detail']['Configuration']['Handler'], '\\n',\n",
" 'trigger uuid:', function['triggers'][0]['UUID'], '\\n',\n",
" 'trigger topic:', function['triggers'][0]['Topics'][0], '\\n')"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -536,11 +566,13 @@
"'''\n",
" List all triggered created by the user.\n",
" expected return (if all triggers are deleted): None \n",
" expected return (otherwise): {'function_name': ..., 'function_detail': ..., 'triggers': [...]}\n",
"''' # noqa: E501\n",
" expected return (otherwise): \n",
" {'function_name': ..., 'function_detail': ..., 'triggers': [...]}\n",
"'''\n",
"for function in c.list_triggers()['triggers']:\n",
" print('trigger name:', function['function_name'], '\\n',\n",
" 'trigger handler name:', function['function_detail']['Configuration']['Handler'], '\\n', # noqa: E501\n",
" 'trigger handler name:', \n",
" function['function_detail']['Configuration']['Handler'], '\\n',\n",
" 'trigger uuid:', function['triggers'][0]['UUID'], '\\n',\n",
" 'trigger topic:', function['triggers'][0]['Topics'][0], '\\n')"
]
Expand Down Expand Up @@ -863,7 +895,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Clean up: Reset `topic1` and `topic2`, Unregister `topic2`"
"## Clean up: Reset and unregister topics"
]
},
{
Expand All @@ -874,6 +906,7 @@
"source": [
"print(c.reset_topic(topic1))\n",
"print(c.reset_topic(topic2))\n",
"print(c.unregister_topic(topic1))\n",
"print(c.unregister_topic(topic2))"
]
},
Expand Down

0 comments on commit d4110eb

Please sign in to comment.