Spaces:
Running
Running
stlaurentjr
commited on
Commit
•
fe3440b
1
Parent(s):
abac7d4
Upload send_output.ipynb
Browse files- notebooks/send_output.ipynb +122 -0
notebooks/send_output.ipynb
ADDED
@@ -0,0 +1,122 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"cells": [
|
3 |
+
{
|
4 |
+
"cell_type": "code",
|
5 |
+
"execution_count": null,
|
6 |
+
"id": "437b5656-e96f-4d3c-a1cf-463f1c8b5370",
|
7 |
+
"metadata": {},
|
8 |
+
"outputs": [],
|
9 |
+
"source": [
|
10 |
+
"# https://colab.research.google.com/drive/1ot8pODgystx1D6_zvsALDSvjACBF1cj6#scrollTo=RF1bMqhBOpSZ"
|
11 |
+
]
|
12 |
+
},
|
13 |
+
{
|
14 |
+
"cell_type": "code",
|
15 |
+
"execution_count": 3,
|
16 |
+
"id": "a70a098b-abd1-4aaf-96bc-1f42c1eb0f95",
|
17 |
+
"metadata": {
|
18 |
+
"tags": []
|
19 |
+
},
|
20 |
+
"outputs": [
|
21 |
+
{
|
22 |
+
"name": "stdout",
|
23 |
+
"output_type": "stream",
|
24 |
+
"text": [
|
25 |
+
"Архив 'outputs_archive_20231108-113718.zip' успешно создан.\n"
|
26 |
+
]
|
27 |
+
}
|
28 |
+
],
|
29 |
+
"source": [
|
30 |
+
"import os\n",
|
31 |
+
"import subprocess\n",
|
32 |
+
"from datetime import datetime\n",
|
33 |
+
"from IPython.display import clear_output\n",
|
34 |
+
"\n",
|
35 |
+
"# Путь к папке, которую необходимо архивировать\n",
|
36 |
+
"folder_to_zip = '/workspace/sd/stable-diffusion-webui/outputs/'\n",
|
37 |
+
"\n",
|
38 |
+
"# Создаем имя архива с меткой времени\n",
|
39 |
+
"timestamp = datetime.now().strftime('%Y%m%d-%H%M%S')\n",
|
40 |
+
"archive_name = f'outputs_archive_{timestamp}.zip'\n",
|
41 |
+
"\n",
|
42 |
+
"# Создаем архив\n",
|
43 |
+
"subprocess.run(['zip', '-r', archive_name, folder_to_zip], check=True)\n",
|
44 |
+
"\n",
|
45 |
+
"# Очищаем вывод в ячейке\n",
|
46 |
+
"clear_output(wait=True)\n",
|
47 |
+
"\n",
|
48 |
+
"# Выводим сообщение об успешной операции\n",
|
49 |
+
"print(f\"Архив '{archive_name}' успешно создан.\")\n"
|
50 |
+
]
|
51 |
+
},
|
52 |
+
{
|
53 |
+
"cell_type": "code",
|
54 |
+
"execution_count": 5,
|
55 |
+
"id": "c6e7af58-76c3-4da7-88f7-f8f0f27f2165",
|
56 |
+
"metadata": {
|
57 |
+
"tags": []
|
58 |
+
},
|
59 |
+
"outputs": [
|
60 |
+
{
|
61 |
+
"name": "stderr",
|
62 |
+
"output_type": "stream",
|
63 |
+
"text": [
|
64 |
+
"Sending 'outputs_archive_20231108-113718.zip' (61.1 MB)\n",
|
65 |
+
"Code is: 2010-lagoon-exit-husband-0\n",
|
66 |
+
"On the other computer run\n",
|
67 |
+
"\n",
|
68 |
+
"runpodctl receive 2010-lagoon-exit-husband-0\n",
|
69 |
+
"\n",
|
70 |
+
"Sending (->35.233.165.219:42774)\n",
|
71 |
+
"outputs_archive_20231108-113718.zip 100% |████████████████████| (61/61 MB, 3.640 MB/s) \n",
|
72 |
+
" \r"
|
73 |
+
]
|
74 |
+
},
|
75 |
+
{
|
76 |
+
"name": "stdout",
|
77 |
+
"output_type": "stream",
|
78 |
+
"text": [
|
79 |
+
"\n"
|
80 |
+
]
|
81 |
+
}
|
82 |
+
],
|
83 |
+
"source": [
|
84 |
+
"# Отправляем архив с использованием команды runpodctl send\n",
|
85 |
+
"send_command = f\"runpodctl send {archive_name}\"\n",
|
86 |
+
"send_result = subprocess.run(send_command, shell=True, stdout=subprocess.PIPE, text=True)\n",
|
87 |
+
"\n",
|
88 |
+
"# Выводим результат отправки\n",
|
89 |
+
"print(send_result.stdout)"
|
90 |
+
]
|
91 |
+
},
|
92 |
+
{
|
93 |
+
"cell_type": "code",
|
94 |
+
"execution_count": null,
|
95 |
+
"id": "609c22d2-3a15-4831-b5eb-5741b0ca1910",
|
96 |
+
"metadata": {},
|
97 |
+
"outputs": [],
|
98 |
+
"source": []
|
99 |
+
}
|
100 |
+
],
|
101 |
+
"metadata": {
|
102 |
+
"kernelspec": {
|
103 |
+
"display_name": "Python 3 (ipykernel)",
|
104 |
+
"language": "python",
|
105 |
+
"name": "python3"
|
106 |
+
},
|
107 |
+
"language_info": {
|
108 |
+
"codemirror_mode": {
|
109 |
+
"name": "ipython",
|
110 |
+
"version": 3
|
111 |
+
},
|
112 |
+
"file_extension": ".py",
|
113 |
+
"mimetype": "text/x-python",
|
114 |
+
"name": "python",
|
115 |
+
"nbconvert_exporter": "python",
|
116 |
+
"pygments_lexer": "ipython3",
|
117 |
+
"version": "3.10.12"
|
118 |
+
}
|
119 |
+
},
|
120 |
+
"nbformat": 4,
|
121 |
+
"nbformat_minor": 5
|
122 |
+
}
|