|
| 1 | +{ |
| 2 | + "cells": [ |
| 3 | + { |
| 4 | + "cell_type": "markdown", |
| 5 | + "metadata": {}, |
| 6 | + "source": [ |
| 7 | + "## IPS workstation\n", |
| 8 | + "\n", |
| 9 | + "You can use this notebook to quickly generate a tarfile with desired runids for download. " |
| 10 | + ] |
| 11 | + }, |
| 12 | + { |
| 13 | + "cell_type": "code", |
| 14 | + "execution_count": null, |
| 15 | + "metadata": {}, |
| 16 | + "outputs": [], |
| 17 | + "source": [ |
| 18 | + "from pathlib import Path\n", |
| 19 | + "\n", |
| 20 | + "import api_v1\n", |
| 21 | + "from IPython.display import display\n", |
| 22 | + "from ipywidgets import HTML, Button, Layout, Textarea\n", |
| 23 | + "\n", |
| 24 | + "widget1 = Textarea(\n", |
| 25 | + " value='',\n", |
| 26 | + " placeholder='Enter runids you want to download, delimited by either spaces or newlines',\n", |
| 27 | + " description='Enter runids you want to download, delimited by either spaces or newlines',\n", |
| 28 | + " layout=Layout(width='50%', display='flex', flex_flow='column')\n", |
| 29 | + ")\n", |
| 30 | + "\n", |
| 31 | + "widget2 = Button(\n", |
| 32 | + " description='Generate tar from input',\n", |
| 33 | + " layout=Layout(width='300px')\n", |
| 34 | + ")\n", |
| 35 | + "\n", |
| 36 | + "def generate_tarfile(_button_widget):\n", |
| 37 | + " runids = [int(v) for v in widget1.value.split()]\n", |
| 38 | + " display(f'Generating tar file from runids: {runids}')\n", |
| 39 | + " \n", |
| 40 | + " file = Path(api_v1.generate_tar_from_runids(runids))\n", |
| 41 | + " display(f'Generated tar file {file.name} in directory {file.parent}, right click the file in the file browser to download it')\n", |
| 42 | + "\n", |
| 43 | + "widget2.on_click(generate_tarfile)\n", |
| 44 | + "\n", |
| 45 | + "display(widget1,widget2,HTML(\"\"\"<style>\n", |
| 46 | + " .widget-label { width: unset !important; }\n", |
| 47 | + "</style>\"\"\"))" |
| 48 | + ] |
| 49 | + } |
| 50 | + ], |
| 51 | + "metadata": { |
| 52 | + "language_info": { |
| 53 | + "name": "python" |
| 54 | + } |
| 55 | + }, |
| 56 | + "nbformat": 4, |
| 57 | + "nbformat_minor": 2 |
| 58 | +} |
0 commit comments