From 8a1008bc51f5bcd838874e8dcbc2b30a95ccbc7d Mon Sep 17 00:00:00 2001 From: Adam Caprez <acaprez2@unl.edu> Date: Wed, 12 Dec 2018 22:48:48 +0000 Subject: [PATCH] Table shortcode --- .../available_software_for_crane.md | 4 +- .../available_software_for_tusker.md | 4 +- content/guides/submitting_jobs/_index.md | 7 +- .../_index.md} | 11 ++- .../partitions/crane_available_partitions.md | 10 +++ .../partitions/tusker_available_partitions.md | 12 ++++ layouts/partials/custom-head.html | 2 + layouts/shortcodes/table.html | 70 +++++++++++++++++++ static/css/custom.css | 9 +++ static/html/crane-modules.html | 32 --------- static/html/crane-partitions.html | 36 ---------- static/html/tusker-modules.html | 32 --------- static/html/tusker-partitions.html | 36 ---------- static/js/sort-table.js | 25 +++++++ 14 files changed, 142 insertions(+), 148 deletions(-) rename content/guides/submitting_jobs/{available_partitions_on_crane_and_tusker.md => partitions/_index.md} (81%) create mode 100644 content/guides/submitting_jobs/partitions/crane_available_partitions.md create mode 100644 content/guides/submitting_jobs/partitions/tusker_available_partitions.md create mode 100644 layouts/shortcodes/table.html delete mode 100644 static/html/crane-modules.html delete mode 100644 static/html/crane-partitions.html delete mode 100644 static/html/tusker-modules.html delete mode 100644 static/html/tusker-partitions.html create mode 100644 static/js/sort-table.js diff --git a/content/guides/running_applications/available_software_for_crane.md b/content/guides/running_applications/available_software_for_crane.md index 23522970..a652b743 100644 --- a/content/guides/running_applications/available_software_for_crane.md +++ b/content/guides/running_applications/available_software_for_crane.md @@ -1,6 +1,8 @@ +++ title = "Available Software for Crane" description = "List of available software for crane.unl.edu." +scripts = ["https://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.31.1/js/jquery.tablesorter.min.js", "https://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.31.1/js/widgets/widget-pager.min.js","https://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.31.1/js/widgets/widget-filter.min.js","/js/sort-table.js"] +css = ["http://mottie.github.io/tablesorter/css/theme.default.css","https://mottie.github.io/tablesorter/css/theme.dropbox.css", "https://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.31.1/css/jquery.tablesorter.pager.min.css","https://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.31.1/css/filter.formatter.min.css"] +++ {{% notice tip %}} @@ -32,4 +34,4 @@ Some packages list multiple compilers for prerequisites. This means that the package has been built with each version of the compilers listed. {{% /panel %}} -{{< readfile file="/static/html/crane-modules.html" >}} +{{< table url="http://crane-head.unl.edu:8192/lmod/spider/json" >}} diff --git a/content/guides/running_applications/available_software_for_tusker.md b/content/guides/running_applications/available_software_for_tusker.md index bafdc736..6fd0121c 100644 --- a/content/guides/running_applications/available_software_for_tusker.md +++ b/content/guides/running_applications/available_software_for_tusker.md @@ -1,6 +1,8 @@ +++ title = "Available Software for Tusker" description = "List of available software for tusker.unl.edu." +scripts = ["https://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.31.1/js/jquery.tablesorter.min.js", "https://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.31.1/js/widgets/widget-pager.min.js","https://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.31.1/js/widgets/widget-filter.min.js","/js/sort-table.js"] +css = ["http://mottie.github.io/tablesorter/css/theme.default.css","https://mottie.github.io/tablesorter/css/theme.dropbox.css", "https://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.31.1/css/jquery.tablesorter.pager.min.css","https://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.31.1/css/filter.formatter.min.css"] +++ {{% notice tip %}} @@ -32,4 +34,4 @@ Some packages list multiple compilers for prerequisites. This means that the package has been built with each version of the compilers listed. {{% /panel %}} -{{< readfile file="/static/html/tusker-modules.html" >}} +{{< table url="http://tusker-head.unl.edu:8192/lmod/spider/json" >}} diff --git a/content/guides/submitting_jobs/_index.md b/content/guides/submitting_jobs/_index.md index d454f2e3..7adc90e1 100644 --- a/content/guides/submitting_jobs/_index.md +++ b/content/guides/submitting_jobs/_index.md @@ -90,9 +90,8 @@ sleep 60 The name of the job. Will be reported in the job listing. - **partition** The partition the job should run in. Partitions determine the job's - priority and on what nodes the partition can run on. See - [Available Partitions on Crane and Tusker]({{< relref "available_partitions_on_crane_and_tusker" >}}) - for a list of possible partitions. + priority and on what nodes the partition can run on. See the + [Partitions]({{< relref "partitions" >}}) page for a list of possible partitions. - **error** Location of the stderr will be written for the job. `[groupname]` and `[username]` should be replaced your group name and username. @@ -146,7 +145,7 @@ $ squeue -u <username> {{< /highlight >}} Additionally, if you want to see the status of a specific partition, for -example if you are part of a [partition]({{< relref "available_partitions_on_crane_and_tusker" >}}), +example if you are part of a [partition]({{< relref "partitions" >}}), you can use the `-p` option to `squeue`: {{< highlight batch >}} diff --git a/content/guides/submitting_jobs/available_partitions_on_crane_and_tusker.md b/content/guides/submitting_jobs/partitions/_index.md similarity index 81% rename from content/guides/submitting_jobs/available_partitions_on_crane_and_tusker.md rename to content/guides/submitting_jobs/partitions/_index.md index 057ab66f..fa725291 100644 --- a/content/guides/submitting_jobs/available_partitions_on_crane_and_tusker.md +++ b/content/guides/submitting_jobs/partitions/_index.md @@ -1,6 +1,8 @@ +++ -title = "Available partitions on Tusker and Crane" +title = "Partitions" description = "Listing of partitions on Tusker and Crane." +scripts = ["https://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.31.1/js/jquery.tablesorter.min.js", "https://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.31.1/js/widgets/widget-pager.min.js","https://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.31.1/js/widgets/widget-filter.min.js","/js/sort-table.js"] +css = ["http://mottie.github.io/tablesorter/css/theme.default.css","https://mottie.github.io/tablesorter/css/theme.dropbox.css", "https://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.31.1/css/jquery.tablesorter.pager.min.css","https://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.31.1/css/filter.formatter.min.css"] +++ Partitions are used in Crane and Tusker to distinguish different @@ -8,14 +10,11 @@ resources. You can view the partitions with the command `sinfo`. ### Crane: -{{< readfile file="/static/html/crane-partitions.html" >}} +[Full list for Crane]({{< relref "crane_available_partitions" >}}) ### Tusker: -{{< readfile file="/static/html/tusker-partitions.html" >}} - -Two nodes have 512GB of memory instead of 256GB (Max Request = 500GB), -and two have 1024GB of memory (Max Request = 1000GB). +[Full list for Tusker]({{< relref "tusker_available_partitions" >}}) #### Priority for short jobs diff --git a/content/guides/submitting_jobs/partitions/crane_available_partitions.md b/content/guides/submitting_jobs/partitions/crane_available_partitions.md new file mode 100644 index 00000000..a799baca --- /dev/null +++ b/content/guides/submitting_jobs/partitions/crane_available_partitions.md @@ -0,0 +1,10 @@ ++++ +title = "Available Partitions for Crane" +description = "List of available partitions for crane.unl.edu." +scripts = ["https://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.31.1/js/jquery.tablesorter.min.js", "https://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.31.1/js/widgets/widget-pager.min.js","https://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.31.1/js/widgets/widget-filter.min.js","/js/sort-table.js"] +css = ["http://mottie.github.io/tablesorter/css/theme.default.css","https://mottie.github.io/tablesorter/css/theme.dropbox.css", "https://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.31.1/css/jquery.tablesorter.pager.min.css","https://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.31.1/css/filter.formatter.min.css"] ++++ + +### Crane: + +{{< table url="http://crane-head.unl.edu:8192/slurm/partitions/json" >}} diff --git a/content/guides/submitting_jobs/partitions/tusker_available_partitions.md b/content/guides/submitting_jobs/partitions/tusker_available_partitions.md new file mode 100644 index 00000000..810f3793 --- /dev/null +++ b/content/guides/submitting_jobs/partitions/tusker_available_partitions.md @@ -0,0 +1,12 @@ ++++ +title = "Available Partitions for Tusker" +description = "List of available partitions for tusker.unl.edu." +scripts = ["https://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.31.1/js/jquery.tablesorter.min.js", "https://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.31.1/js/widgets/widget-pager.min.js","https://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.31.1/js/widgets/widget-filter.min.js","/js/sort-table.js"] +css = ["http://mottie.github.io/tablesorter/css/theme.default.css","https://mottie.github.io/tablesorter/css/theme.dropbox.css", "https://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.31.1/css/jquery.tablesorter.pager.min.css","https://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.31.1/css/filter.formatter.min.css"] ++++ + +### Tusker: + +{{< table url="http://tusker-head.unl.edu:8192/slurm/partitions/json" >}} + +Two nodes have 512GB of memory instead of 256GB (Max Request = 500GB), and two have 1024GB of memory (Max Request = 1000GB). diff --git a/layouts/partials/custom-head.html b/layouts/partials/custom-head.html index 850a6411..8f6a3a66 100644 --- a/layouts/partials/custom-head.html +++ b/layouts/partials/custom-head.html @@ -1,2 +1,4 @@ <link rel="stylesheet" href="/css/custom.css"> <link href="//cloud.typography.com/7717652/616662/css/fonts.css" type="text/css" rel="stylesheet"> +{{ if isset .Params "scripts" }}{{ range .Params.scripts }}<script src="{{ printf "%s" . | absURL }}"></script>{{ end }}{{ end }} +{{ if isset .Params "css" }}{{ range .Params.css }}<link rel="stylesheet" href="{{ printf "%s" . | absURL }}">{{ end }}{{ end }} diff --git a/layouts/shortcodes/table.html b/layouts/shortcodes/table.html new file mode 100644 index 00000000..537ada68 --- /dev/null +++ b/layouts/shortcodes/table.html @@ -0,0 +1,70 @@ +{{ $url := .Get "url" }} +{{ $json := getJSON $url }} +{{ if $json.table_generated }} +<p><em>last generated {{ $json.table_generated }}</em></p> +{{ end }} +<div class="pager"> + <img src="http://mottie.github.com/tablesorter/addons/pager/icons/first.png" class="first"/> + <img src="http://mottie.github.com/tablesorter/addons/pager/icons/prev.png" class="prev"/> + <!-- the "pagedisplay" can be any element, including an input --> + <span class="pagedisplay" data-pager-output-filtered="{startRow:input} – {endRow} / {filteredRows} of {totalRows} total rows"></span> + <img src="http://mottie.github.com/tablesorter/addons/pager/icons/next.png" class="next"/> + <img src="http://mottie.github.com/tablesorter/addons/pager/icons/last.png" class="last"/> + <select class="pagesize"> + <option value="5">5</option> + <option value="10">10</option> + <option value="20">20</option> + <option value="30">30</option> + <option value="40">40</option> + <option value="all">All Rows</option> + </select> + <select class="gotoPage" title="Select page number"> + <option value="1">1</option> + <option value="2">2</option> + <option value="3">3</option> + <option value="4">4</option> + <option value="5">5</option> + </select> +</div> + +<table class="sorttable"> + <thead> + <tr> + {{ range $table_header := $json.table_header }} + <th>{{ $table_header }}</th> + {{ end }} + </tr> + </thead> + <tbody> + {{ range $table_row := $json.table_data }} + <tr> + {{ range $table_data := $table_row }} + <td>{{ $table_data }}</td> + {{ end }} + </tr> + {{ end }} + </tbody> +</table> + +<div class="pager"> + <img src="http://mottie.github.com/tablesorter/addons/pager/icons/first.png" class="first"/> + <img src="http://mottie.github.com/tablesorter/addons/pager/icons/prev.png" class="prev"/> + <!-- the "pagedisplay" can be any element, including an input --> + <span class="pagedisplay" data-pager-output-filtered="{startRow:input} – {endRow} / {filteredRows} of {totalRows} total rows"></span> + <img src="http://mottie.github.com/tablesorter/addons/pager/icons/next.png" class="next"/> + <img src="http://mottie.github.com/tablesorter/addons/pager/icons/last.png" class="last"/> + <select class="pagesize"> + <option value="10">10</option> + <option value="20">20</option> + <option value="30">30</option> + <option value="40">40</option> + <option value="all">All Rows</option> + </select> + <select class="gotoPage" title="Select page number"> + <option value="1">1</option> + <option value="2">2</option> + <option value="3">3</option> + <option value="4">4</option> + <option value="5">5</option> + </select> +</div> diff --git a/static/css/custom.css b/static/css/custom.css index ec010dd0..05d2d379 100644 --- a/static/css/custom.css +++ b/static/css/custom.css @@ -109,3 +109,12 @@ color: #6a0000; border-bottom-style: dotted; border-bottom-width: 1px; } + +.sorttable table { +table-layout: fixed; +} + +.pager img, select, input { + display: inline !important; +} + diff --git a/static/html/crane-modules.html b/static/html/crane-modules.html deleted file mode 100644 index 9aac938e..00000000 --- a/static/html/crane-modules.html +++ /dev/null @@ -1,32 +0,0 @@ -<table style="font-size: small"> - <colgroup> - <col style="width: 8.83281%;"/> - <col style="width: 7.9085%;"/> - <col style="width: 10.4543%;"/> - <col style="width: 25.3754%;"/> - <col style="width: 10.2429%;"/> - <col style="width: 10.57098%;"/> - <col style="width: 19.80757%;"/> - </colgroup> -<tbody> -<tr style="font-size: x-small"> -<th>Name</th> -<th>Version</th> -<th>Module Name</th> -<th>Prerequisites</th> -<th>Type</th> -<th>Domain</th> -<th>Description</th> -</tr> - -<tr> -<td colspan="1">abacus</td> -<td colspan="1" >1.0.1</td> -<td colspan="1">abacus/1.0</td> -<td colspan="1">compiler/intel/13:openmpi/1.8</td> -<td colspan="1">library</td> -<td colspan="1">runtime support</td> -<td colspan="1">Finite element simulation</td> -</tr> -</tbody> -</table> diff --git a/static/html/crane-partitions.html b/static/html/crane-partitions.html deleted file mode 100644 index 938e5127..00000000 --- a/static/html/crane-partitions.html +++ /dev/null @@ -1,36 +0,0 @@ -<p><em>last generated Wed Nov 7 15:47:00 2018</em></p> - <table style="font-size: small"> - <colgroup> - <col style="width: 8.83281%;"/> - <col style="width: 11.9085%;"/> - <col style="width: 18.4543%;"/> - <col style="width: 18.3754%;"/> - <col style="width: 19.2429%;"/> - <col style="width: 7.57098%;"/> - <col style="width: 7.80757%;"/> - <col style="width: 7.80757%;"/> - </colgroup> - <tbody> - <tr style="font-size: x-small"> - <th>Partition</th> - <th>Owner</th> - <th>Node total (NODExCPU/MEM/FEATURE)</th> - <th>Description</th> - <th>SLURM Specification</span> </th> - <th>Max Job Run Time</th> - <th>Max CPUs Per User</th> - <th>Max Jobs Per User</th> - </tr> - - <tr> - <td colspan="1">batch</td> - <td colspan="1">shared</td> - <td colspan="1">399 total (377x16/64GB/ib; 6x36/256GB/opa; 16x36/512GB/opa)</td> - <td colspan="1">(default, no specification)</td> - <td colspan="1">#SBATCH --partition=batch</td> - <td colspan="1" style="text-align: center;" >7-00:00:00</td> - <td colspan="1" style="text-align: center;" >ib:2000 opa:576</td> - <td colspan="1" style="text-align: center;" >1000</td> - </tr> - </tbody> - </table> diff --git a/static/html/tusker-modules.html b/static/html/tusker-modules.html deleted file mode 100644 index 9aac938e..00000000 --- a/static/html/tusker-modules.html +++ /dev/null @@ -1,32 +0,0 @@ -<table style="font-size: small"> - <colgroup> - <col style="width: 8.83281%;"/> - <col style="width: 7.9085%;"/> - <col style="width: 10.4543%;"/> - <col style="width: 25.3754%;"/> - <col style="width: 10.2429%;"/> - <col style="width: 10.57098%;"/> - <col style="width: 19.80757%;"/> - </colgroup> -<tbody> -<tr style="font-size: x-small"> -<th>Name</th> -<th>Version</th> -<th>Module Name</th> -<th>Prerequisites</th> -<th>Type</th> -<th>Domain</th> -<th>Description</th> -</tr> - -<tr> -<td colspan="1">abacus</td> -<td colspan="1" >1.0.1</td> -<td colspan="1">abacus/1.0</td> -<td colspan="1">compiler/intel/13:openmpi/1.8</td> -<td colspan="1">library</td> -<td colspan="1">runtime support</td> -<td colspan="1">Finite element simulation</td> -</tr> -</tbody> -</table> diff --git a/static/html/tusker-partitions.html b/static/html/tusker-partitions.html deleted file mode 100644 index fb1b4248..00000000 --- a/static/html/tusker-partitions.html +++ /dev/null @@ -1,36 +0,0 @@ -<p><em>last generated Wed Nov 7 15:14:27 2018</em></p> - <table style="font-size: small"> - <colgroup> - <col style="width: 8.83281%;"/> - <col style="width: 11.9085%;"/> - <col style="width: 18.4543%;"/> - <col style="width: 18.3754%;"/> - <col style="width: 19.2429%;"/> - <col style="width: 7.57098%;"/> - <col style="width: 7.80757%;"/> - <col style="width: 7.80757%;"/> - </colgroup> - <tbody> - <tr style="font-size: x-small"> - <th>Partition</th> - <th>Owner</th> - <th>Node total (NODExCPU/MEM/FEATURE)</th> - <th>Description</th> - <th>SLURM Specification</span> </th> - <th>Max Job Run Time</th> - <th>Max CPUs Per User</th> - <th>Max Jobs Per User</th> - </tr> - - <tr> - <td colspan="1" >batch</td> - <td colspan="1" >shared</td> - <td colspan="1" >38 total (38x64/256GB/none)</td> - <td colspan="1" >(default, no specification)</td> - <td colspan="1" >#SBATCH --partition=batch</td> - <td colspan="1" style="text-align: center;" >7-00:00:00</td> - <td colspan="1" style="text-align: center;" >2000</td> - <td colspan="1" style="text-align: center;" >1000</td> - </tr> - </tbody> - </table> diff --git a/static/js/sort-table.js b/static/js/sort-table.js new file mode 100644 index 00000000..4cd8dfbd --- /dev/null +++ b/static/js/sort-table.js @@ -0,0 +1,25 @@ +$(function(){ + $(".sorttable") + .tablesorter({theme: "dropbox", sortList: [[0,0]], widthFixed: true, ignoreCase: true, widgets: ['pager','filter'], + widgetOptions: { + pager_css: { + container : 'tablesorter-pager', // class added to make included pager.css file work + errorRow : 'tablesorter-errorRow', // error information row (don't include period at beginning); styled in theme file + disabled : 'disabled' // class added to arrows @ extremes (i.e. prev/first arrows "disabled" on first page) + }, + pager_selectors: { + container : '.pager', // target the pager markup (wrapper) + first : '.first', // go to first page arrow + prev : '.prev', // previous page arrow + next : '.next', // next page arrow + last : '.last', // go to last page arrow + gotoPage : '.gotoPage', // go to page selector - select dropdown that sets the current page + pageDisplay : '.pagedisplay', // location of where the "output" is displayed + pageSize : '.pagesize' // page size selector - select dropdown that sets the "size" option + }, + pager_output: '{startRow:input} – {endRow} / {totalRows} rows', + } + + }); + }); + -- GitLab