{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": { "scrolled": false }, "outputs": [], "source": [ "import pandas as pd\n", "import seaborn as sns\n", "from datetime import datetime, timedelta, date\n", "from humanize import naturalsize\n", "import matplotlib.pyplot as plt\n", "import numpy as np\n", "\n", "%matplotlib inline" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Qiita's resource allocation - quick update from previous version\n", "\n", "After the 2023.10 release we noticed that:\n", "1. `job-output-folder` `VALIDATE` command didn't have valid request because those jobs do not have sample/column values\n", "2. The default during a resource allocation for time is minutes and the calculations were done in seconds" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Loading data\n", "\n", "First you will need to run `generate-allocation-summary.py` in Qiita as the qiita user (or whatever user runs qiita in your system). The resulting file would be: `job_[date].tsv.gz`.\n", "\n", "The generated file will have these columns: `['JobID', 'ElapsedRaw', 'MaxRSS', 'Submit', 'Start', 'MaxRSS.1', 'CPUTimeRAW', 'ReqMem', 'AllocCPUS', 'AveVMSize', 'QiitaID', 'external_id', 'sId', 'sName', 'sVersion', 'cId', 'cName', 'samples', 'columns', 'input_size', 'extra_info'],`." ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "scrolled": true }, "outputs": [], "source": [ "m1g = 2**30\n", "df = pd.read_csv('jobs_2023-10-04.tsv.gz', sep='\\t', dtype={'extra_info': str})\n", "df['ElapsedRawTime'] = pd.to_timedelta(df.ElapsedRawTime)" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'There are 101147 successful jobs since we moved to barnacle2 and the largest external_id is: 1581986'" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# for reference for the next iteration of this notebook\n", "f'There are {df.shape[0]} successful jobs since we moved to barnacle2 and the largest external_id is: {df.external_id.max()}'" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# 1. Getting the default values for `job-output-folder` `VALIDATE`" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
ElapsedRawTimeMaxRSSRaw
countminmaxcountminmax
cNamesName
ValidateBIOM type - BIOM6870 days 00:00:550 days 01:03:49687222.8 MB82.0 GB
Diversity types - FeatureData60 days 00:01:200 days 00:02:496331.4 MB384.3 MB
Diversity types - alpha_vector1230 days 00:01:123 days 04:36:54123289.3 MB101.5 GB
Diversity types - distance_matrix1170 days 00:00:370 days 00:03:55117122.7 MB12.5 GB
Diversity types - ordination_results1070 days 00:00:390 days 00:03:19107117.2 MB2.9 GB
Sequencing Data Type - Demultiplexed430 days 00:00:350 days 00:12:234383.4 MB517.4 MB
Sequencing Data Type - FASTA20 days 00:00:560 days 00:02:23279.8 MB83.6 MB
Sequencing Data Type - FASTQ320 days 00:00:410 days 01:50:443278.7 MB84.4 MB
Sequencing Data Type - SFF10 days 00:01:090 days 00:01:09179.6 MB79.6 MB
Sequencing Data Type - per_sample_FASTQ730 days 00:00:360 days 18:13:217377.6 MB83.6 MB
Visualization types - q2_visualization1330 days 00:00:360 days 00:24:5613351.5 MB67.5 MB
qtp-job-output-folder - job-output-folder2280 days 00:00:310 days 00:04:0622818.3 MB46.7 MB
\n", "
" ], "text/plain": [ " ElapsedRawTime \\\n", " count \n", "cName sName \n", "Validate BIOM type - BIOM 687 \n", " Diversity types - FeatureData 6 \n", " Diversity types - alpha_vector 123 \n", " Diversity types - distance_matrix 117 \n", " Diversity types - ordination_results 107 \n", " Sequencing Data Type - Demultiplexed 43 \n", " Sequencing Data Type - FASTA 2 \n", " Sequencing Data Type - FASTQ 32 \n", " Sequencing Data Type - SFF 1 \n", " Sequencing Data Type - per_sample_FASTQ 73 \n", " Visualization types - q2_visualization 133 \n", " qtp-job-output-folder - job-output-folder 228 \n", "\n", " \\\n", " min \n", "cName sName \n", "Validate BIOM type - BIOM 0 days 00:00:55 \n", " Diversity types - FeatureData 0 days 00:01:20 \n", " Diversity types - alpha_vector 0 days 00:01:12 \n", " Diversity types - distance_matrix 0 days 00:00:37 \n", " Diversity types - ordination_results 0 days 00:00:39 \n", " Sequencing Data Type - Demultiplexed 0 days 00:00:35 \n", " Sequencing Data Type - FASTA 0 days 00:00:56 \n", " Sequencing Data Type - FASTQ 0 days 00:00:41 \n", " Sequencing Data Type - SFF 0 days 00:01:09 \n", " Sequencing Data Type - per_sample_FASTQ 0 days 00:00:36 \n", " Visualization types - q2_visualization 0 days 00:00:36 \n", " qtp-job-output-folder - job-output-folder 0 days 00:00:31 \n", "\n", " MaxRSSRaw \\\n", " max count \n", "cName sName \n", "Validate BIOM type - BIOM 0 days 01:03:49 687 \n", " Diversity types - FeatureData 0 days 00:02:49 6 \n", " Diversity types - alpha_vector 3 days 04:36:54 123 \n", " Diversity types - distance_matrix 0 days 00:03:55 117 \n", " Diversity types - ordination_results 0 days 00:03:19 107 \n", " Sequencing Data Type - Demultiplexed 0 days 00:12:23 43 \n", " Sequencing Data Type - FASTA 0 days 00:02:23 2 \n", " Sequencing Data Type - FASTQ 0 days 01:50:44 32 \n", " Sequencing Data Type - SFF 0 days 00:01:09 1 \n", " Sequencing Data Type - per_sample_FASTQ 0 days 18:13:21 73 \n", " Visualization types - q2_visualization 0 days 00:24:56 133 \n", " qtp-job-output-folder - job-output-folder 0 days 00:04:06 228 \n", "\n", " \n", " min max \n", "cName sName \n", "Validate BIOM type - BIOM 222.8 MB 82.0 GB \n", " Diversity types - FeatureData 331.4 MB 384.3 MB \n", " Diversity types - alpha_vector 289.3 MB 101.5 GB \n", " Diversity types - distance_matrix 122.7 MB 12.5 GB \n", " Diversity types - ordination_results 117.2 MB 2.9 GB \n", " Sequencing Data Type - Demultiplexed 83.4 MB 517.4 MB \n", " Sequencing Data Type - FASTA 79.8 MB 83.6 MB \n", " Sequencing Data Type - FASTQ 78.7 MB 84.4 MB \n", " Sequencing Data Type - SFF 79.6 MB 79.6 MB \n", " Sequencing Data Type - per_sample_FASTQ 77.6 MB 83.6 MB \n", " Visualization types - q2_visualization 51.5 MB 67.5 MB \n", " qtp-job-output-folder - job-output-folder 18.3 MB 46.7 MB " ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "cname = 'Validate'\n", "_df = df[(df.cName == cname)].copy()\n", "\n", "summary = _df[_df['samples'].isnull() & _df['columns'].isnull()].groupby(\n", " ['cName', 'sName'])[['ElapsedRawTime', 'MaxRSSRaw']].agg(['count', 'min', 'max']).copy()\n", "\n", "summary[('MaxRSSRaw', 'min')] = summary[('MaxRSSRaw', 'min')].apply(naturalsize)\n", "summary[('MaxRSSRaw', 'max')] = summary[('MaxRSSRaw', 'max')].apply(naturalsize)\n", "\n", "display(summary)\n", "\n", "# New allocation: -p qiita -N 1 -n 1 --mem 100mb --time 00:40:00" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# 2. Updates for the seconds to minute confusion" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "=============\n", "=============\n", " allocation = '-p qiita -N 1 -n 1 '\n", " || '--mem (2**30)+({samples}*150000) '\n", " || '--time 240'\n", "\n", "UPDATE qiita.processing_job_resource_allocation set\n", " allocation = '-p qiita -N 1 -n 1 '\n", " || '--mem (2**30)+({samples}*150000) '\n", " || '--time 4'\n", " WHERE job_type = 'RESOURCE_PARAMS_COMMAND' and\n", " name = 'delete_sample_or_column';\n", "\n", "=============\n", "=============\n", " allocation = '-p qiita -N 1 -n 1 '\n", " || '--mem {samples}*10000000'\n", " || '--time 61200'\n", "\n", "UPDATE qiita.processing_job_resource_allocation set\n", " allocation = '-p qiita -N 1 -n 1 '\n", " || '--mem {samples}*10000000'\n", " || '--time 1020'\n", " WHERE job_type = 'RESOURCE_PARAMS_COMMAND' and\n", " name = 'Sequence Processing Pipeline';\n", "\n", "=============\n", "=============\n", " allocation = '-p qiita -N 1 -n 1 --mem 4g --time 900'\n", "\n", "UPDATE qiita.processing_job_resource_allocation set\n", " allocation = '-p qiita -N 1 -n 1 --mem 4g --time 15'\n", " WHERE job_type = 'RESOURCE_PARAMS_COMMAND' and\n", " name = 'Filter samples from table [filter_samples]';\n", "\n", "=============\n", "=============\n", " allocation = '-p qiita -N 1 -n 1 '\n", " || '--mem (2**31)+({input_size}*6) if\n", "(2**31)+({input_size}*6) < 13958643712 else 13958643712 '\n", " || '--time 2400'\n", "\n", "UPDATE qiita.processing_job_resource_allocation set\n", " allocation = '-p qiita -N 1 -n 1 '\n", " || '--mem (2**31)+({input_size}*6) if\n", "(2**31)+({input_size}*6) < 13958643712 else 13958643712 '\n", " || '--time 40'\n", " WHERE job_type = 'RESOURCE_PARAMS_COMMAND' and\n", " name = 'Rarefy table [rarefy]';\n", "\n", "=============\n", "=============\n", " allocation = '-p qiita -N 1 -n 1 '\n", " || '--mem 14g'\n", " || '--time 360'\n", "\n", "UPDATE qiita.processing_job_resource_allocation set\n", " allocation = '-p qiita -N 1 -n 1 '\n", " || '--mem 14g '\n", " || '--time 6'\n", " WHERE job_type = 'RESOURCE_PARAMS_COMMAND' and\n", " name = 'Alpha diversity (phylogenetic) [alpha_phylogenetic]';\n", "\n", "\n", "=============\n", "=============\n", " allocation = '-p qiita -N 1 -n 1 '\n", " || '--mem (2**33)+(2**30)+(({samples}*{columns}*{input_size})/4500000)'\n", " || '--time 1800'\n", "\n", "UPDATE qiita.processing_job_resource_allocation set\n", " allocation = '-p qiita -N 1 -n 1 '\n", " || '--mem\n", "(2**33)+(2**30)+(({samples}*{columns}*{input_size})/4500000) '\n", " || '--time 30'\n", " WHERE job_type = 'RESOURCE_PARAMS_COMMAND' and\n", " name = 'Visualize and Interact with Principal Coordinates Analysis\n", "Plots [plot]';\n", "\n", "=============\n", "=============\n", " allocation = '-p qiita -N 1 -n 1 '\n", " || '--mem (2**32)+(({samples}*{columns}*{input_size}')/20000)'\n", " || '--time 90000'\n", "\n", "UPDATE qiita.processing_job_resource_allocation set\n", " allocation = '-p qiita -N 1 -n 1 '\n", " || '--mem (2**32)+(({samples}*{columns}*{input_size})/20000) '\n", " || '--time 1500'\n", " WHERE job_type = 'RESOURCE_PARAMS_COMMAND' and\n", " name = 'Alpha rarefaction curves [alpha_rarefaction]';\n", "\n", "=============\n", "=============\n", " allocation = '-p qiita -N 1 -n 1 '\n", " || '--mem 2*(2**30)+{input_size} if 2*(2**30)+{input_size} < 16*(2**30) else 16*(2**30)'\n", " || '--time 36000'\n", "\n", "UPDATE qiita.processing_job_resource_allocation set\n", " allocation = '-p qiita -N 1 -n 1 '\n", " || '--mem 2*(2**30)+{input_size} if 2*(2**30)+{input_size}\n", "< 16*(2**30) else 16*(2**30) '\n", " || '--time 600'\n", " WHERE job_type = 'RESOURCE_PARAMS_COMMAND' and\n", " name = 'Trimming';\n", "\n", "=============\n", "=============\n", " allocation = '-p qiita -N 1 -n 1 '\n", " || '--mem (2**30)+({samples}*{columns}*2000)'\n", " || '--time 2300'\n", "\n", "UPDATE qiita.processing_job_resource_allocation set\n", " allocation = '-p qiita -N 1 -n 1 '\n", " || '--mem (2**30)+({samples}*{columns}*2000) '\n", " || '--time 39'\n", " WHERE job_type = 'RESOURCE_PARAMS_COMMAND' and\n", " name = 'update_sample_template';" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.7" } }, "nbformat": 4, "nbformat_minor": 4 }