Last active
March 6, 2023 16:17
-
-
Save sanchezcarlosjr/3d1501d01e87a2eee7ffcabe20b0bc0e to your computer and use it in GitHub Desktop.
checkpoint-restore-with-dmtcp.ipynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"nbformat": 4, | |
"nbformat_minor": 0, | |
"metadata": { | |
"colab": { | |
"provenance": [], | |
"authorship_tag": "ABX9TyNJmFZujUJPIwWSdrsy7buK", | |
"include_colab_link": true | |
}, | |
"kernelspec": { | |
"name": "python3", | |
"display_name": "Python 3" | |
}, | |
"language_info": { | |
"name": "python" | |
} | |
}, | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "view-in-github", | |
"colab_type": "text" | |
}, | |
"source": [ | |
"<a href=\"https://colab.research.google.com/gist/sanchezcarlosjr/3d1501d01e87a2eee7ffcabe20b0bc0e/checkpoint-restore-with-dmtcp.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": { | |
"id": "aWE_xmaRCgwB" | |
}, | |
"outputs": [], | |
"source": [ | |
"!wget https://github.com/dmtcp/dmtcp/releases/download/2.6.0/dmtcp-2.6.0.tar.gz\n", | |
"!tar -xvzf dmtcp-2.6.0.tar.gz\n", | |
"%cd dmtcp-2.6.0\n", | |
"!./configure && make && make install" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"%%writefile my_script.py\n", | |
"import time\n", | |
"\n", | |
"def my_function():\n", | |
" i = 0\n", | |
" while True:\n", | |
" print(\"Iteration\", i)\n", | |
" i = i +1\n", | |
" time.sleep(1)\n", | |
"\n", | |
"if __name__ == '__main__':\n", | |
" my_function()" | |
], | |
"metadata": { | |
"colab": { | |
"base_uri": "https://localhost:8080/" | |
}, | |
"id": "YTQqW2qECoPb", | |
"outputId": "f6f26226-e88a-4727-f01d-b23f513ee2b3" | |
}, | |
"execution_count": null, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"name": "stdout", | |
"text": [ | |
"Overwriting my_script.py\n" | |
] | |
} | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"!dmtcp_launch -i 1 python my_script.py" | |
], | |
"metadata": { | |
"colab": { | |
"base_uri": "https://localhost:8080/" | |
}, | |
"id": "RbXUnVMHC_go", | |
"outputId": "e6f4a86b-7185-4861-8e3f-029e50c8de91" | |
}, | |
"execution_count": null, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"name": "stdout", | |
"text": [ | |
"Iteration 0\n", | |
"Iteration 1\n", | |
"Iteration 2\n", | |
"Iteration 3\n", | |
"Iteration 4\n", | |
"Iteration 5\n", | |
"Iteration 6\n", | |
"Traceback (most recent call last):\n", | |
" File \"my_script.py\", line 11, in <module>\n", | |
" my_function()\n", | |
" File \"my_script.py\", line 8, in my_function\n", | |
" time.sleep(1)\n", | |
"KeyboardInterrupt\n", | |
"^C\n" | |
] | |
} | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"! ./dmtcp_restart_script.sh" | |
], | |
"metadata": { | |
"colab": { | |
"base_uri": "https://localhost:8080/" | |
}, | |
"id": "glc7wxuIDdk3", | |
"outputId": "9fde4bc4-cbd2-461b-b759-8dd57083661e" | |
}, | |
"execution_count": null, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"name": "stdout", | |
"text": [ | |
"./dmtcp_restart_script.sh: line 30: nslookup: command not found\n", | |
"./dmtcp_restart_script.sh: line 43: /sbin/ifconfig: No such file or directory\n", | |
"WARNING: Running dmtcp_restart as root can be dangerous.\n", | |
" An unknown checkpoint image or bugs in DMTCP may lead to unforeseen\n", | |
" consequences. Continuing as root ....\n", | |
"[40000] WARNING at terminal.cpp:111 in restore_term_settings; REASON='JWARNING(false) failed'\n", | |
"Message: :skip restore terminal step -- we are in BACKGROUND\n", | |
"Iteration 6\n", | |
"Iteration 7\n", | |
"Iteration 8\n", | |
"Iteration 9\n", | |
"Iteration 10\n", | |
"Iteration 11\n", | |
"Traceback (most recent call last):\n", | |
" File \"my_script.py\", line 11, in <module>\n", | |
" my_function()\n", | |
" File \"my_script.py\", line 8, in my_function\n", | |
" time.sleep(1)\n", | |
"KeyboardInterrupt\n", | |
"^C\n" | |
] | |
} | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"! ./dmtcp_restart_script.sh" | |
], | |
"metadata": { | |
"colab": { | |
"base_uri": "https://localhost:8080/" | |
}, | |
"id": "xjSpxdP_D0fn", | |
"outputId": "1676d1ea-471f-4466-e6b3-caf11815af90" | |
}, | |
"execution_count": null, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"name": "stdout", | |
"text": [ | |
"./dmtcp_restart_script.sh: line 30: nslookup: command not found\n", | |
"./dmtcp_restart_script.sh: line 43: /sbin/ifconfig: No such file or directory\n", | |
"WARNING: Running dmtcp_restart as root can be dangerous.\n", | |
" An unknown checkpoint image or bugs in DMTCP may lead to unforeseen\n", | |
" consequences. Continuing as root ....\n", | |
"[40000] WARNING at terminal.cpp:111 in restore_term_settings; REASON='JWARNING(false) failed'\n", | |
"Message: :skip restore terminal step -- we are in BACKGROUND\n", | |
"Iteration 11\n", | |
"Iteration 12\n", | |
"Iteration 13\n", | |
"Iteration 14\n", | |
"Iteration 15\n", | |
"Iteration 16\n", | |
"Traceback (most recent call last):\n", | |
" File \"my_script.py\", line 11, in <module>\n", | |
" my_function()\n", | |
" File \"my_script.py\", line 8, in my_function\n", | |
" time.sleep(1)\n", | |
"KeyboardInterrupt\n", | |
"^C\n" | |
] | |
} | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"source": [], | |
"metadata": { | |
"id": "lXdWdhQoEKa3" | |
}, | |
"execution_count": null, | |
"outputs": [] | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment