diff --git a/python/ray/WebUI.ipynb b/python/ray/WebUI.ipynb index b5316a00a..011d3ce66 100644 --- a/python/ray/WebUI.ipynb +++ b/python/ray/WebUI.ipynb @@ -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, diff --git a/python/ray/experimental/state.py b/python/ray/experimental/state.py index 06f31a97f..390b1dea2 100644 --- a/python/ray/experimental/state.py +++ b/python/ray/experimental/state.py @@ -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",