From c676c03804f16ce3177a3fe8cd160a54fe22ea07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C5=A1a=20Tomi=C4=87?= Date: Tue, 23 Jan 2024 12:10:53 +0100 Subject: [PATCH] fix(docs): Update the links for running the trustworthy metrics notebook online (#92) - Add a google colaboratory link - Download data.json from the internet if not present locally (required by google colab) --- .../TrustworthyMetricsAnalytics.ipynb | 14 +++++++++----- docs/trustworthy-metrics/trustworthy-metrics.md | 7 ++++--- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/docs/trustworthy-metrics/TrustworthyMetricsAnalytics.ipynb b/docs/trustworthy-metrics/TrustworthyMetricsAnalytics.ipynb index 255a1076..32689ab0 100644 --- a/docs/trustworthy-metrics/TrustworthyMetricsAnalytics.ipynb +++ b/docs/trustworthy-metrics/TrustworthyMetricsAnalytics.ipynb @@ -11,15 +11,15 @@ "import numpy as np\n", "import pathlib\n", "import json\n", - "import matplotlib.pyplot as plt" + "import matplotlib.pyplot as plt\n", + "import requests\n", + "import pathlib" ] }, { "cell_type": "markdown", "id": "dbbc6db6-faf4-4690-9a38-055a84c48ee9", - "metadata": { - "jp-MarkdownHeadingCollapsed": true - }, + "metadata": {}, "source": [ "# Load data" ] @@ -31,6 +31,10 @@ "metadata": {}, "outputs": [], "source": [ + "data_json = pathlib.Path(\"data.json\")\n", + "if not data_json.exists():\n", + " contents = requests.get(\"https://github.com/dfinity/dre/raw/main/docs/trustworthy-metrics/data.json\").text\n", + " data_json.write_text(contents)\n", "data = json.load(pathlib.Path(\"data.json\").open())\n", "data_flat = []\n", "for subnet_id, subnet_data in data.items():\n", @@ -500,7 +504,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "1b4ab4655a4948aabe03a0739823edb0", + "model_id": "50a9615b28454f75a8da7c8c5763e2da", "version_major": 2, "version_minor": 0 }, diff --git a/docs/trustworthy-metrics/trustworthy-metrics.md b/docs/trustworthy-metrics/trustworthy-metrics.md index db030ce7..1cdab02d 100644 --- a/docs/trustworthy-metrics/trustworthy-metrics.md +++ b/docs/trustworthy-metrics/trustworthy-metrics.md @@ -73,7 +73,7 @@ If you used a purely new identity (which is advised since the tool can then para 2. replace `` in the command with something like: `--private-key-pem identity.pem` -If you used an HSM then replace `` with: `-hsm-slot 0 --hsm-key-id 0 --hsm-pin $(cat )`. Note that the HSM is less parallel than the key file due to hardware limits, so getting metrics with an HSM will be a bit slower. +If you used an HSM then replace `` with: `--hsm-slot 0 --hsm-key-id 0 --hsm-pin $(cat )`. Note that the HSM is less parallel than the key file due to hardware limits, so getting metrics with an HSM will be a bit slower. Even if created the wallet canister with an HSM you can still add another file-based controller to the wallet canister: @@ -103,8 +103,9 @@ dre --private-key-pem identity.pem trustworthy-metrics nanx4-baaaa-aaaap-qb4sq-c Or with an HSM: ```bash -dre --private-key-pem identity.pem trustworthy-metrics nanx4-baaaa-aaaap-qb4sq-cai 0 > data.json +dre --hsm-slot 0 --hsm-key-id 0 --hsm-pin "" trustworthy-metrics nanx4-baaaa-aaaap-qb4sq-cai 0 > data.json ``` You can check some examples of the analytics possible with the IC Mainnet data in the following [Jupyter Notebook](./TrustworthyMetricsAnalytics.ipynb) -If you don't have Jupyter notebooks locally, you can use [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/dfinity/dre/main?labpath=docs%2Ftrustworthy-metrics%2FTrustworthyMetricsAnalytics.ipynb) to run it online. + +If you don't have Jupyter notebooks locally, you can use [Google Colaboratory](https://colab.research.google.com/github/dfinity/dre/blob/main/docs/trustworthy-metrics/TrustworthyMetricsAnalytics.ipynb) or [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/dfinity/dre/main?labpath=docs%2Ftrustworthy-metrics%2FTrustworthyMetricsAnalytics.ipynb) to run it online for free.