|
67 | 67 | }, |
68 | 68 | { |
69 | 69 | "cell_type": "code", |
| 70 | + "execution_count": null, |
70 | 71 | "metadata": { |
71 | 72 | "cellView": "form", |
72 | 73 | "colab": { |
|
75 | 76 | "id": "nXDYU_oP8GIr", |
76 | 77 | "outputId": "aee909b7-1a48-43c2-81b7-3659e0fc9c79" |
77 | 78 | }, |
| 79 | + "outputs": [], |
78 | 80 | "source": [ |
79 | 81 | "# @title Authorization Form\n", |
80 | 82 | "ACCOUNT_ID = \"ACCOUNT_ID\" # @param {type:\"string\"}\n", |
|
115 | 117 | " from mat3ra.utils.jupyterlite.packages import install_packages\n", |
116 | 118 | "\n", |
117 | 119 | " await install_packages(\"api_examples\")" |
118 | | - ], |
119 | | - "outputs": [], |
120 | | - "execution_count": null |
| 120 | + ] |
121 | 121 | }, |
122 | 122 | { |
123 | 123 | "attachments": {}, |
|
131 | 131 | }, |
132 | 132 | { |
133 | 133 | "cell_type": "code", |
| 134 | + "execution_count": null, |
134 | 135 | "metadata": { |
135 | 136 | "id": "rG9HfjnR8GIs" |
136 | 137 | }, |
| 138 | + "outputs": [], |
137 | 139 | "source": [ |
138 | 140 | "# Import settings file and utils file\n", |
139 | 141 | "from utils.settings import ENDPOINT_ARGS, ACCOUNT_ID\n", |
140 | | - "from utils.generic import (\n", |
| 142 | + "from utils.api import (\n", |
141 | 143 | " wait_for_jobs_to_finish,\n", |
142 | 144 | " get_property_by_subworkflow_and_unit_indicies,\n", |
| 145 | + ")\n", |
| 146 | + "from utils.visualize import (\n", |
143 | 147 | " dataframe_to_html,\n", |
144 | 148 | " display_JSON,\n", |
145 | 149 | ")\n", |
|
150 | 154 | "from exabyte_api_client.endpoints.materials import MaterialEndpoints\n", |
151 | 155 | "from exabyte_api_client.endpoints.bank_materials import BankMaterialEndpoints\n", |
152 | 156 | "from exabyte_api_client.endpoints.bank_workflows import BankWorkflowEndpoints" |
153 | | - ], |
154 | | - "outputs": [], |
155 | | - "execution_count": null |
| 157 | + ] |
156 | 158 | }, |
157 | 159 | { |
158 | 160 | "attachments": {}, |
|
176 | 178 | }, |
177 | 179 | { |
178 | 180 | "cell_type": "code", |
| 181 | + "execution_count": null, |
179 | 182 | "metadata": { |
180 | 183 | "colab": { |
181 | 184 | "base_uri": "https://localhost:8080/" |
182 | 185 | }, |
183 | 186 | "id": "le9f28c08GIt", |
184 | 187 | "outputId": "27e9b94f-29dd-4742-9448-2e1bce79cb15" |
185 | 188 | }, |
| 189 | + "outputs": [], |
186 | 190 | "source": [ |
187 | 191 | "# Get some account information\n", |
188 | 192 | "project_endpoints = ProjectEndpoints(*ENDPOINT_ARGS)\n", |
|
215 | 219 | "# Submit the job\n", |
216 | 220 | "job_endpoints.submit(job[\"_id\"])\n", |
217 | 221 | "wait_for_jobs_to_finish(job_endpoints, [job[\"_id\"]])" |
218 | | - ], |
219 | | - "outputs": [], |
220 | | - "execution_count": null |
| 222 | + ] |
221 | 223 | }, |
222 | 224 | { |
223 | 225 | "attachments": {}, |
|
244 | 246 | }, |
245 | 247 | { |
246 | 248 | "cell_type": "code", |
| 249 | + "execution_count": null, |
247 | 250 | "metadata": { |
248 | 251 | "colab": { |
249 | 252 | "base_uri": "https://localhost:8080/" |
250 | 253 | }, |
251 | 254 | "id": "yijRe7qp8GIv", |
252 | 255 | "outputId": "19b147fc-736e-41f0-bd0f-6f69e77b0adf" |
253 | 256 | }, |
| 257 | + "outputs": [], |
254 | 258 | "source": [ |
255 | 259 | "files = job_endpoints.list_files(job[\"_id\"])\n", |
256 | 260 | "paths = [file[\"key\"] for file in files]\n", |
257 | 261 | "for path in paths:\n", |
258 | 262 | " if \"outdir\" not in path:\n", |
259 | 263 | " print(path)" |
260 | | - ], |
261 | | - "outputs": [], |
262 | | - "execution_count": null |
| 264 | + ] |
263 | 265 | }, |
264 | 266 | { |
265 | 267 | "attachments": {}, |
|
284 | 286 | }, |
285 | 287 | { |
286 | 288 | "cell_type": "code", |
| 289 | + "execution_count": null, |
287 | 290 | "metadata": { |
288 | 291 | "colab": { |
289 | 292 | "base_uri": "https://localhost:8080/" |
290 | 293 | }, |
291 | 294 | "id": "U2dq0A1e8GIw", |
292 | 295 | "outputId": "7b4f8c36-6342-46fa-d02e-0825b44e6c64" |
293 | 296 | }, |
| 297 | + "outputs": [], |
294 | 298 | "source": [ |
295 | 299 | "for file in files:\n", |
296 | 300 | " if file[\"name\"] == \"pw_scf.out\":\n", |
297 | 301 | " output_file_metadata = file\n", |
298 | 302 | "display_JSON(output_file_metadata)" |
299 | | - ], |
300 | | - "outputs": [], |
301 | | - "execution_count": null |
| 303 | + ] |
302 | 304 | }, |
303 | 305 | { |
304 | 306 | "attachments": {}, |
|
314 | 316 | }, |
315 | 317 | { |
316 | 318 | "cell_type": "code", |
| 319 | + "execution_count": null, |
317 | 320 | "metadata": { |
318 | 321 | "colab": { |
319 | 322 | "base_uri": "https://localhost:8080/" |
320 | 323 | }, |
321 | 324 | "id": "OpdOMuDT8GIw", |
322 | 325 | "outputId": "e4e2e6b1-8431-439a-8606-ae500534e601" |
323 | 326 | }, |
| 327 | + "outputs": [], |
324 | 328 | "source": [ |
325 | 329 | "from mat3ra.utils.jupyterlite.url import read_from_url\n", |
326 | 330 | "\n", |
|
330 | 334 | "lines = output_file.split(\"\\n\")\n", |
331 | 335 | "for line in lines[-90:]:\n", |
332 | 336 | " print(line)" |
333 | | - ], |
334 | | - "outputs": [], |
335 | | - "execution_count": null |
| 337 | + ] |
336 | 338 | }, |
337 | 339 | { |
338 | 340 | "attachments": {}, |
|
348 | 350 | }, |
349 | 351 | { |
350 | 352 | "cell_type": "code", |
| 353 | + "execution_count": null, |
351 | 354 | "metadata": { |
352 | 355 | "id": "COPinBrO8GIx" |
353 | 356 | }, |
| 357 | + "outputs": [], |
354 | 358 | "source": [ |
355 | 359 | "from utils.jupyterlite import download_content_to_file\n", |
356 | 360 | "\n", |
357 | 361 | "download_content_to_file(content=output_file, filename=output_file_metadata[\"name\"])" |
358 | | - ], |
359 | | - "outputs": [], |
360 | | - "execution_count": null |
| 362 | + ] |
361 | 363 | } |
362 | 364 | ], |
363 | 365 | "metadata": { |
|
0 commit comments