Skip to content

Instantly share code, notes, and snippets.

@usmcamp0811
Last active February 22, 2019 00:56
Show Gist options
  • Save usmcamp0811/78cc7fb369a3ba3a19d6ea2ab515733c to your computer and use it in GitHub Desktop.
Save usmcamp0811/78cc7fb369a3ba3a19d6ea2ab515733c to your computer and use it in GitHub Desktop.
An attempt at getting papermill to work with Julia Notebooks.
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"papermill": {
"duration": 1.903743,
"end_time": "2019-02-22T00:43:48.258910",
"exception": false,
"start_time": "2019-02-22T00:43:46.355167",
"status": "completed"
},
"tags": [
"injected-parameters"
]
},
"outputs": [
{
"data": {
"text/plain": [
"932"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Parameters\n",
"say = \"this was a test\"\n",
"plot_size = 932\n"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": true,
"papermill": {
"duration": 0.004784,
"end_time": "2019-02-22T00:43:48.266478",
"exception": false,
"start_time": "2019-02-22T00:43:48.261694",
"status": "completed"
},
"tags": [
"parameter"
]
},
"outputs": [
{
"data": {
"text/plain": [
"100"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Parameters\n",
"say = \"hello world\"\n",
"plot_size = 100"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"papermill": {
"duration": 0.127691,
"end_time": "2019-02-22T00:43:48.396982",
"exception": false,
"start_time": "2019-02-22T00:43:48.269291",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"hello world\n"
]
}
],
"source": [
"println(say)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": true,
"papermill": {
"duration": 25.043555,
"end_time": "2019-02-22T00:44:13.444126",
"exception": false,
"start_time": "2019-02-22T00:43:48.400571",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"image/svg+xml": [
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n",
"<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"600\" height=\"400\" viewBox=\"0 0 2400 1600\">\n",
"<defs>\n",
" <clipPath id=\"clip6800\">\n",
" <rect x=\"0\" y=\"0\" width=\"2000\" height=\"2000\"/>\n",
" </clipPath>\n",
"</defs>\n",
"<defs>\n",
" <clipPath id=\"clip6801\">\n",
" <rect x=\"0\" y=\"0\" width=\"2400\" height=\"1600\"/>\n",
" </clipPath>\n",
"</defs>\n",
"<polygon clip-path=\"url(#clip6801)\" points=\"\n",
"0,1600 2400,1600 2400,0 0,0 \n",
" \" fill=\"#ffffff\" fill-rule=\"evenodd\" fill-opacity=\"1\"/>\n",
"<defs>\n",
" <clipPath id=\"clip6802\">\n",
" <rect x=\"480\" y=\"0\" width=\"1681\" height=\"1600\"/>\n",
" </clipPath>\n",
"</defs>\n",
"<polygon clip-path=\"url(#clip6801)\" points=\"\n",
"188.156,1503.47 2321.26,1503.47 2321.26,47.2441 188.156,47.2441 \n",
" \" fill=\"#ffffff\" fill-rule=\"evenodd\" fill-opacity=\"1\"/>\n",
"<defs>\n",
" <clipPath id=\"clip6803\">\n",
" <rect x=\"188\" y=\"47\" width=\"2134\" height=\"1457\"/>\n",
" </clipPath>\n",
"</defs>\n",
"<polyline clip-path=\"url(#clip6803)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
" 228.2,1503.47 228.2,47.2441 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip6803)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
" 736.373,1503.47 736.373,47.2441 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip6803)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
" 1244.54,1503.47 1244.54,47.2441 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip6803)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
" 1752.72,1503.47 1752.72,47.2441 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip6803)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
" 2260.89,1503.47 2260.89,47.2441 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip6803)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
" 188.156,1475.48 2321.26,1475.48 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip6803)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
" 188.156,1123.67 2321.26,1123.67 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip6803)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
" 188.156,771.869 2321.26,771.869 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip6803)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
" 188.156,420.066 2321.26,420.066 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip6803)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
" 188.156,68.2622 2321.26,68.2622 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip6801)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 188.156,1503.47 2321.26,1503.47 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip6801)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 188.156,1503.47 188.156,47.2441 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip6801)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 228.2,1503.47 228.2,1481.63 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip6801)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 736.373,1503.47 736.373,1481.63 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip6801)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 1244.54,1503.47 1244.54,1481.63 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip6801)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 1752.72,1503.47 1752.72,1481.63 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip6801)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 2260.89,1503.47 2260.89,1481.63 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip6801)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 188.156,1475.48 220.153,1475.48 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip6801)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 188.156,1123.67 220.153,1123.67 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip6801)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 188.156,771.869 220.153,771.869 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip6801)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 188.156,420.066 220.153,420.066 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip6801)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 188.156,68.2622 220.153,68.2622 \n",
" \"/>\n",
"<g clip-path=\"url(#clip6801)\">\n",
"<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;\" transform=\"rotate(0, 228.2, 1557.47)\" x=\"228.2\" y=\"1557.47\">0</text>\n",
"</g>\n",
"<g clip-path=\"url(#clip6801)\">\n",
"<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;\" transform=\"rotate(0, 736.373, 1557.47)\" x=\"736.373\" y=\"1557.47\">25</text>\n",
"</g>\n",
"<g clip-path=\"url(#clip6801)\">\n",
"<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;\" transform=\"rotate(0, 1244.54, 1557.47)\" x=\"1244.54\" y=\"1557.47\">50</text>\n",
"</g>\n",
"<g clip-path=\"url(#clip6801)\">\n",
"<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;\" transform=\"rotate(0, 1752.72, 1557.47)\" x=\"1752.72\" y=\"1557.47\">75</text>\n",
"</g>\n",
"<g clip-path=\"url(#clip6801)\">\n",
"<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;\" transform=\"rotate(0, 2260.89, 1557.47)\" x=\"2260.89\" y=\"1557.47\">100</text>\n",
"</g>\n",
"<g clip-path=\"url(#clip6801)\">\n",
"<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;\" transform=\"rotate(0, 164.156, 1492.98)\" x=\"164.156\" y=\"1492.98\">0.00</text>\n",
"</g>\n",
"<g clip-path=\"url(#clip6801)\">\n",
"<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;\" transform=\"rotate(0, 164.156, 1141.17)\" x=\"164.156\" y=\"1141.17\">0.25</text>\n",
"</g>\n",
"<g clip-path=\"url(#clip6801)\">\n",
"<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;\" transform=\"rotate(0, 164.156, 789.369)\" x=\"164.156\" y=\"789.369\">0.50</text>\n",
"</g>\n",
"<g clip-path=\"url(#clip6801)\">\n",
"<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;\" transform=\"rotate(0, 164.156, 437.566)\" x=\"164.156\" y=\"437.566\">0.75</text>\n",
"</g>\n",
"<g clip-path=\"url(#clip6801)\">\n",
"<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;\" transform=\"rotate(0, 164.156, 85.7622)\" x=\"164.156\" y=\"85.7622\">1.00</text>\n",
"</g>\n",
"<polyline clip-path=\"url(#clip6803)\" style=\"stroke:#009af9; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 248.527,546.563 268.854,445.777 289.181,1420.61 309.508,94.7036 329.835,200.589 350.162,1318.94 370.489,139.026 390.815,807.74 411.142,310.819 431.469,1392.37 \n",
" 451.796,684.871 472.123,1042.04 492.45,364.562 512.777,1442.74 533.104,516.4 553.431,592.258 573.757,1014.08 594.084,547.073 614.411,1219.32 634.738,361.3 \n",
" 655.065,614.267 675.392,422.264 695.719,722.831 716.046,895.001 736.373,1384.14 756.699,841.557 777.026,1199.94 797.353,393.13 817.68,279.369 838.007,440.032 \n",
" 858.334,826.952 878.661,395.9 898.988,143.303 919.314,933.927 939.641,320.688 959.968,88.4582 980.295,1350.42 1000.62,1358.27 1020.95,689.825 1041.28,627.04 \n",
" 1061.6,609.246 1081.93,687.604 1102.26,932.739 1122.58,1176.25 1142.91,966.144 1163.24,547.399 1183.56,452.397 1203.89,783.994 1224.22,1013.1 1244.54,1164.1 \n",
" 1264.87,303.615 1285.2,938.391 1305.53,1110.13 1325.85,1115.62 1346.18,473.709 1366.51,683.276 1386.83,658.366 1407.16,832.747 1427.49,709.232 1447.81,551.352 \n",
" 1468.14,455.818 1488.47,1412.05 1508.79,447.241 1529.12,1170.26 1549.45,796.269 1569.77,1405.87 1590.1,169.543 1610.43,445.019 1630.76,1158.66 1651.08,882.738 \n",
" 1671.41,320.394 1691.74,891.371 1712.06,1462.26 1732.39,399.866 1752.72,1162.85 1773.04,753.765 1793.37,220.236 1813.7,706.33 1834.02,1127.8 1854.35,110.135 \n",
" 1874.68,778.062 1895.01,1224.19 1915.33,119.044 1935.66,895.193 1955.99,994.356 1976.31,730.655 1996.64,189.854 2016.97,942.896 2037.29,1120.39 2057.62,190.458 \n",
" 2077.95,1335.77 2098.27,714.014 2118.6,988.903 2138.93,991.901 2159.25,1154.82 2179.58,430.315 2199.91,124.741 2220.24,1047.29 2240.56,562.414 2260.89,660.747 \n",
" \n",
" \"/>\n",
"<polygon clip-path=\"url(#clip6801)\" points=\"\n",
"1958.43,251.724 2249.26,251.724 2249.26,130.764 1958.43,130.764 \n",
" \" fill=\"#ffffff\" fill-rule=\"evenodd\" fill-opacity=\"1\"/>\n",
"<polyline clip-path=\"url(#clip6801)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 1958.43,251.724 2249.26,251.724 2249.26,130.764 1958.43,130.764 1958.43,251.724 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip6801)\" style=\"stroke:#009af9; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 1982.43,191.244 2126.43,191.244 \n",
" \"/>\n",
"<g clip-path=\"url(#clip6801)\">\n",
"<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:start;\" transform=\"rotate(0, 2150.43, 208.744)\" x=\"2150.43\" y=\"208.744\">y1</text>\n",
"</g>\n",
"</svg>\n"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"using Plots\n",
"\n",
"plot(1:plot_size, rand(plot_size))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"papermill": {
"duration": 0.003252,
"end_time": "2019-02-22T00:44:13.451268",
"exception": false,
"start_time": "2019-02-22T00:44:13.448016",
"status": "completed"
},
"tags": []
},
"outputs": [],
"source": []
}
],
"metadata": {
"celltoolbar": "Tags",
"kernelspec": {
"display_name": "Julia 1.1.0",
"language": "julia",
"name": "julia-1.1"
},
"language_info": {
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "1.1.0"
},
"papermill": {
"duration": 37.098984,
"end_time": "2019-02-22T00:44:18.727233",
"environment_variables": {},
"exception": null,
"input_path": "input.ipynb",
"output_path": "output.ipynb",
"parameters": {
"plot_size": 932,
"say": "this was a test"
},
"start_time": "2019-02-22T00:43:41.628249",
"version": "0.18.1"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
#!/bin/bash
# the command used to get these results
papermill input.ipynb output.ipynb -p say "this was a test" -p plot_size 932
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment