{ "cells": [ { "cell_type": "code", "execution_count": null, "id": "437b5656-e96f-4d3c-a1cf-463f1c8b5370", "metadata": {}, "outputs": [], "source": [ "# https://colab.research.google.com/drive/1ot8pODgystx1D6_zvsALDSvjACBF1cj6#scrollTo=RF1bMqhBOpSZ" ] }, { "cell_type": "code", "execution_count": 3, "id": "a70a098b-abd1-4aaf-96bc-1f42c1eb0f95", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Архив 'outputs_archive_20231108-113718.zip' успешно создан.\n" ] } ], "source": [ "import os\n", "import subprocess\n", "from datetime import datetime\n", "from IPython.display import clear_output\n", "\n", "# Путь к папке, которую необходимо архивировать\n", "folder_to_zip = '/workspace/sd/stable-diffusion-webui/outputs/'\n", "\n", "# Создаем имя архива с меткой времени\n", "timestamp = datetime.now().strftime('%Y%m%d-%H%M%S')\n", "archive_name = f'outputs_archive_{timestamp}.zip'\n", "\n", "# Создаем архив\n", "subprocess.run(['zip', '-r', archive_name, folder_to_zip], check=True)\n", "\n", "# Очищаем вывод в ячейке\n", "clear_output(wait=True)\n", "\n", "# Выводим сообщение об успешной операции\n", "print(f\"Архив '{archive_name}' успешно создан.\")\n" ] }, { "cell_type": "code", "execution_count": 5, "id": "c6e7af58-76c3-4da7-88f7-f8f0f27f2165", "metadata": { "tags": [] }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "Sending 'outputs_archive_20231108-113718.zip' (61.1 MB)\n", "Code is: 2010-lagoon-exit-husband-0\n", "On the other computer run\n", "\n", "runpodctl receive 2010-lagoon-exit-husband-0\n", "\n", "Sending (->35.233.165.219:42774)\n", "outputs_archive_20231108-113718.zip 100% |████████████████████| (61/61 MB, 3.640 MB/s) \n", " \r" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\n" ] } ], "source": [ "# Отправляем архив с использованием команды runpodctl send\n", "send_command = f\"runpodctl send {archive_name}\"\n", "send_result = subprocess.run(send_command, shell=True, stdout=subprocess.PIPE, text=True)\n", "\n", "# Выводим результат отправки\n", "print(send_result.stdout)" ] }, { "cell_type": "code", "execution_count": null, "id": "609c22d2-3a15-4831-b5eb-5741b0ca1910", "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.10.12" } }, "nbformat": 4, "nbformat_minor": 5 }