diff --git a/slurm-2sql.ipynb b/slurm-2sql.ipynb index 1e70d597dc4c6ce0feb87e6cbfdd32f051e842cd..cf06ea8140f1fac8c337cf3e4e7540beb114d24b 100644 --- a/slurm-2sql.ipynb +++ b/slurm-2sql.ipynb @@ -87,8 +87,123 @@ "# must run\n", "\n", "# df_2 is database with only ReqMemCpu and ReqMemNode, and ArrayTaskID\n", - "df_2 = df_1.loc[:,['JobName','ReqMemCPU', 'ReqMemNode', 'ArrayJobID','ArrayTaskID']]\n", - "#df_2.head(5)" + "df_2 = df_1.loc[:,['Partition','JobName','JobID']]\n", + "df_2.head(5)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# must run\n", + "\n", + "# fills empty strings in Partition column with NaN and then filters them out to give a dataset of users with no empty strings \n", + "nan_value = float(\"NaN\")\n", + "\n", + "df_2.replace(\"\", nan_value, inplace=True)\n", + "\n", + "df_2.dropna(subset = [\"Partition\"], inplace=True)\n", + "df_2.head(5)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + " # must run\n", + "\n", + "# df_state is df_batch grouped by state - shows number of jobs that resulted in each state\n", + "df_partition = df_2.groupby('Partition')['JobID'].describe().reset_index()\n", + "df_partition" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Create an array with the colors you want to use\n", + "colors = [\"#FF0B04\", \"#4374B3\"]\n", + "# Set your custom color palette\n", + "customPalette = sns.set_palette(sns.color_palette(colors))\n", + "# Use the parameter palette and use your own palette across all your\n", + "# plots\n", + "ax = sns.scatterplot(x='day', y='miles_walked', data=dataset, hue='day_category', palette=customPalette)\n", + "# Customize the axes and title\n", + "ax.set_title(\"Miles walked\")\n", + "ax.set_xlabel(\"day\")\n", + "ax.set_ylabel(\"total miles\")\n", + "# Remove top and right borders\n", + "ax.spines['top'].set_visible(False)\n", + "ax.spines['right'].set_visible(False)\n", + "plt.show()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "sns.set(font= 'DejaVu Sans',\n", + " rc={\n", + " 'axes.axisbelow': False,\n", + " 'axes.edgecolor': 'grey',\n", + " 'axes.facecolor': 'None',\n", + " 'axes.grid': False,\n", + " 'axes.labelcolor': 'grey',\n", + " 'axes.spines.right': False,\n", + " 'axes.spines.top': False,\n", + " 'figure.facecolor': 'white',\n", + " 'lines.solid_capstyle': 'round',\n", + " 'patch.edgecolor': 'w',\n", + " 'patch.force_edgecolor': True,\n", + " 'text.color': 'grey',\n", + " 'xtick.bottom': True,\n", + " 'xtick.color': 'grey',\n", + " 'xtick.direction': 'out',\n", + " 'xtick.top': False,\n", + " 'ytick.color': 'grey',\n", + " 'ytick.direction': 'out',\n", + " 'ytick.left': False,\n", + " 'ytick.right': False})" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "sns.set_context(\"notebook\", rc={\"font.size\":16,\n", + " \"axes.titlesize\":20,\n", + " \"axes.labelsize\":18})" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# must run\n", + "\n", + "# gives list of partitions possible\n", + "partition_colors = [Express, Short, Medium, Long, Interactive, PascalNodes]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "custom_palette2 = sns.set_palette(sns.color_palette('Dark2',8))" ] }, { @@ -98,16 +213,18 @@ "outputs": [], "source": [ "# shows all user requested cpu memory for array and non array jobs\n", - "fig = sns.distplot(df_2['ReqMemCPU'], kde=False, label='ReqMemCPU', color = \"green\")\n", "\n", - "fig.set_yscale('log')\n", + "fig = sns.barplot(x=\"Partition\", y=\"count\", data=df_partition, palette=custom_palette2)\n", + " #hue='Partition', \n", "\n", - "plt.legend(prop={'size': 12},loc='upper right',bbox_to_anchor=(2.25, 1.0),ncol=1)\n", + "fig.set_yscale('log')\n", "\n", "plt.title('title')\n", "\n", "plt.xlabel('x axis')\n", - "plt.ylabel('y axis')" + "plt.ylabel('y axis')\n", + "\n", + "plt.show()" ] }, {