Add task ID and object ID search boxes to web UI. (#704)

* Task search box.

* Cleaned up.

* Small reformatting.

* Add object table search box.
This commit is contained in:
alanamarzoev
2017-07-01 14:48:23 -07:00
committed by Robert Nishihara
parent 716469160e
commit 2b11a7bca2
2 changed files with 69 additions and 6 deletions
+65 -6
View File
@@ -10,16 +10,75 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"import os\n",
"import pprint\n",
"import ipywidgets as widgets\n",
"import ray\n",
"\n",
"redis_address = os.environ[\"REDIS_ADDRESS\"]\n",
"ray.init(redis_address=redis_address)"
"from IPython.display import display\n",
"\n",
"ray.init(redis_address=os.environ[\"REDIS_ADDRESS\"])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**Evaluate the box below to search for objects.**"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"object_search = widgets.Text(\n",
" value=\"\",\n",
" placeholder=\"Object ID\",\n",
" description=\"Search for an object:\",\n",
" disabled=False\n",
")\n",
"display(object_search)\n",
"\n",
"def handle_submit(sender):\n",
" pp = pprint.PrettyPrinter()\n",
" pp.pprint(ray.global_state.object_table(object_search.value))\n",
"\n",
"object_search.on_submit(handle_submit)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**Evaluate the box below to search for tasks.**"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"task_search = widgets.Text(\n",
" value=\"\",\n",
" placeholder=\"Task ID\",\n",
" description=\"Search for a task:\",\n",
" disabled=False\n",
")\n",
"display(task_search)\n",
"\n",
"def handle_submit(sender):\n",
" pp = pprint.PrettyPrinter()\n",
" pp.pprint(ray.global_state.task_table(task_search.value))\n",
"\n",
"task_search.on_submit(handle_submit)"
]
}
],
@@ -39,7 +98,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.0"
"version": "3.6.1"
}
},
"nbformat": 4,
+4
View File
@@ -132,6 +132,10 @@ class GlobalState(object):
Returns:
A dictionary with information about the object ID in question.
"""
# Allow the argument to be either an ObjectID or a hex string.
if not isinstance(object_id, ray.local_scheduler.ObjectID):
object_id = ray.local_scheduler.ObjectID(hex_to_binary(object_id))
# Return information about a single object ID.
object_locations = self._execute_command(object_id,
"RAY.OBJECT_TABLE_LOOKUP",