stlaurentjr commited on
Commit
0ea9934
1 Parent(s): fbd1baa

Update notebooks/send_output.ipynb

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