gnetcli-adapter 2.0.3__tar.gz → 2.0.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- gnetcli_adapter-2.0.4/LICENSE +21 -0
- {gnetcli_adapter-2.0.3 → gnetcli_adapter-2.0.4}/PKG-INFO +3 -2
- {gnetcli_adapter-2.0.3 → gnetcli_adapter-2.0.4}/src/gnetcli_adapter/gnetcli_adapter.py +23 -12
- {gnetcli_adapter-2.0.3 → gnetcli_adapter-2.0.4}/README.md +0 -0
- {gnetcli_adapter-2.0.3 → gnetcli_adapter-2.0.4}/pyproject.toml +0 -0
- {gnetcli_adapter-2.0.3 → gnetcli_adapter-2.0.4}/src/gnetcli_adapter/__init__.py +0 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 annetutil
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: gnetcli_adapter
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.4
|
|
4
4
|
Summary: Gnetcli-server adapter for Annet
|
|
5
5
|
Author-email: Aleksandr Balezin <gescheit12@gmail.com>
|
|
6
6
|
Requires-Python: >=3.10
|
|
@@ -11,6 +11,7 @@ Classifier: License :: OSI Approved :: MIT License
|
|
|
11
11
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
12
12
|
Classifier: Programming Language :: Python :: 3.10
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
License-File: LICENSE
|
|
14
15
|
Requires-Dist: annet>=1.0.0
|
|
15
16
|
Requires-Dist: gnetclisdk>=1.0.31
|
|
16
17
|
Requires-Dist: pydantic_settings
|
|
@@ -231,23 +231,34 @@ class GnetcliFetcher(Fetcher, AdapterWithConfig, AdapterWithName):
|
|
|
231
231
|
devices: List[Device],
|
|
232
232
|
files_to_download: Optional[Dict[Device, List[str]]] = None,
|
|
233
233
|
processes: int = 1,
|
|
234
|
-
|
|
234
|
+
max_slots: int = 0,
|
|
235
|
+
):
|
|
235
236
|
running = {}
|
|
236
237
|
failed_running = {}
|
|
238
|
+
|
|
239
|
+
tasks = {}
|
|
237
240
|
for device in devices:
|
|
238
|
-
|
|
239
|
-
if files_to_download
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
else:
|
|
244
|
-
dev_res = {}
|
|
241
|
+
if files_to_download or device.is_pc():
|
|
242
|
+
if files_to_download:
|
|
243
|
+
files = files_to_download.get(device, [])
|
|
244
|
+
task = asyncio.create_task(self.adownload_dev(device=device, files=files))
|
|
245
|
+
tasks[task] = device
|
|
245
246
|
else:
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
247
|
+
running[device] = {}
|
|
248
|
+
else:
|
|
249
|
+
task = asyncio.create_task(self.afetch_dev(device=device))
|
|
250
|
+
tasks[task] = device
|
|
251
|
+
|
|
252
|
+
if not tasks:
|
|
253
|
+
return running, failed_running
|
|
254
|
+
|
|
255
|
+
done, pending = await asyncio.wait(list(tasks), return_when=asyncio.ALL_COMPLETED)
|
|
256
|
+
for task in done:
|
|
257
|
+
device = tasks[task]
|
|
258
|
+
if (exc := task.exception()) is not None:
|
|
259
|
+
failed_running[device] = exc
|
|
249
260
|
else:
|
|
250
|
-
running[device] =
|
|
261
|
+
running[device] = task.result()
|
|
251
262
|
return running, failed_running
|
|
252
263
|
|
|
253
264
|
async def afetch_dev(self, device: Device) -> str:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|