Skip to content

Commit e76ad6c

Browse files
committed
Now use the API to get the generated instance data
1 parent 058b947 commit e76ad6c

1 file changed

Lines changed: 37 additions & 11 deletions

File tree

examples-proposed/024-aggregated-compute-ensemble/input_dir/instance_base_notebook.ipynb

Lines changed: 37 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,43 @@
2929
"outputs": [],
3030
"execution_count": 5
3131
},
32+
{
33+
"metadata": {},
34+
"cell_type": "code",
35+
"outputs": [],
36+
"execution_count": null,
37+
"source": [
38+
"# get the JSON data file generated from the instance\n",
39+
"data_files = ips_analysis_api.get_data()"
40+
],
41+
"id": "fc9bfad1db6fe246"
42+
},
43+
{
44+
"metadata": {},
45+
"cell_type": "code",
46+
"outputs": [],
47+
"execution_count": null,
48+
"source": [
49+
"# echo what we got for a sanity check\n",
50+
"data_files"
51+
],
52+
"id": "8f9fac74f66daa6b"
53+
},
54+
{
55+
"metadata": {},
56+
"cell_type": "code",
57+
"outputs": [],
58+
"execution_count": null,
59+
"source": [
60+
"for file in data_files[0.0]:\n",
61+
" if file.endswith('_solution.json'):\n",
62+
" solution_json_file = file\n",
63+
" break\n",
64+
"else:\n",
65+
" print('JSON solution file for this ensemble is missing')"
66+
],
67+
"id": "c0883abd61aa1b18"
68+
},
3269
{
3370
"metadata": {
3471
"ExecuteTime": {
@@ -38,17 +75,6 @@
3875
},
3976
"cell_type": "code",
4077
"source": [
41-
"# Find the JSON output from `gen_data.py` that was invoked as a sub-task. It will\n",
42-
"# follow the naming pattern `<instance ID>_solution.json`. It will contain two\n",
43-
"# arrays, `x` and `u`, which we will plot.\n",
44-
"solution_json_file = list(Path(\"..\").rglob(\"*solution.json\"))\n",
45-
"\n",
46-
"if len(solution_json_file) != 1:\n",
47-
" raise RuntimeError(\n",
48-
" f\"Expected exactly one solution JSON file, found {len(solution_json_file)}\"\n",
49-
" )\n",
50-
"solution_json_file = solution_json_file[0]\n",
51-
"\n",
5278
"# Now read the JSON file and extract the data.\n",
5379
"with open(solution_json_file, \"r\") as f:\n",
5480
" solution_data = json.load(f)\n",

0 commit comments

Comments
 (0)