gnetcli-adapter 2.5.1__tar.gz → 2.5.2__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.5.1 → gnetcli_adapter-2.5.2}/PKG-INFO +1 -1
- {gnetcli_adapter-2.5.1 → gnetcli_adapter-2.5.2}/src/gnetcli_adapter/gnetcli_adapter.py +17 -11
- {gnetcli_adapter-2.5.1 → gnetcli_adapter-2.5.2}/LICENSE +0 -0
- {gnetcli_adapter-2.5.1 → gnetcli_adapter-2.5.2}/README.md +0 -0
- {gnetcli_adapter-2.5.1 → gnetcli_adapter-2.5.2}/pyproject.toml +0 -0
- {gnetcli_adapter-2.5.1 → gnetcli_adapter-2.5.2}/src/gnetcli_adapter/__init__.py +0 -0
- {gnetcli_adapter-2.5.1 → gnetcli_adapter-2.5.2}/src/gnetcli_adapter/progress_tracker.py +0 -0
|
@@ -143,22 +143,24 @@ def check_gnetcli_server(server_path: str, config: str = DEFAULT_GNETCLI_SERVER_
|
|
|
143
143
|
|
|
144
144
|
def cleanup():
|
|
145
145
|
if _local_gnetcli_p is not None:
|
|
146
|
+
_local_gnetcli_p.terminate()
|
|
147
|
+
time.sleep(0.05)
|
|
146
148
|
_local_gnetcli_p.kill()
|
|
147
|
-
|
|
149
|
+
time.sleep(0.05)
|
|
148
150
|
|
|
149
151
|
atexit.register(cleanup)
|
|
150
152
|
|
|
151
153
|
|
|
152
154
|
async def gather_with_concurrency(n: int, *coros: list[asyncio.Task]):
|
|
153
155
|
if n == 0:
|
|
154
|
-
return await asyncio.gather(*coros)
|
|
156
|
+
return await asyncio.gather(*coros, return_exceptions=True)
|
|
155
157
|
semaphore = asyncio.Semaphore(n)
|
|
156
158
|
|
|
157
159
|
async def sem_coro(coro):
|
|
158
160
|
async with semaphore:
|
|
159
161
|
return await coro
|
|
160
162
|
|
|
161
|
-
return await asyncio.gather(*(sem_coro(c) for c in coros))
|
|
163
|
+
return await asyncio.gather(*(sem_coro(c) for c in coros), return_exceptions=True)
|
|
162
164
|
|
|
163
165
|
|
|
164
166
|
def get_device_ip(dev: Device) -> Optional[str]:
|
|
@@ -280,24 +282,28 @@ class GnetcliFetcher(Fetcher, AdapterWithConfig, AdapterWithName):
|
|
|
280
282
|
if files_to_download or device.is_pc():
|
|
281
283
|
if files_to_download:
|
|
282
284
|
files = files_to_download.get(device, [])
|
|
283
|
-
task =
|
|
285
|
+
task = self.adownload_dev(device=device, files=files)
|
|
284
286
|
tasks[task] = device
|
|
285
287
|
else:
|
|
286
288
|
running[device] = {}
|
|
287
289
|
else:
|
|
288
|
-
task =
|
|
290
|
+
task = self.afetch_dev(device=device)
|
|
289
291
|
tasks[task] = device
|
|
290
292
|
|
|
291
293
|
if not tasks:
|
|
292
294
|
return running, failed_running
|
|
293
295
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
296
|
+
rtasks_dev = []
|
|
297
|
+
rtasks = []
|
|
298
|
+
for task, dev in tasks.items():
|
|
299
|
+
rtasks.append(task)
|
|
300
|
+
rtasks_dev.append(dev)
|
|
301
|
+
result = await gather_with_concurrency(max_slots, *rtasks)
|
|
302
|
+
for device, dev_res in zip(rtasks_dev, result):
|
|
303
|
+
if isinstance(dev_res, Exception):
|
|
304
|
+
failed_running[device] = dev_res
|
|
299
305
|
else:
|
|
300
|
-
running[device] =
|
|
306
|
+
running[device] = dev_res
|
|
301
307
|
return running, failed_running
|
|
302
308
|
|
|
303
309
|
async def afetch_dev(self, device: Device) -> str:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|