UncountablePythonSDK 0.0.82__py3-none-any.whl → 0.0.83__py3-none-any.whl

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.

Potentially problematic release.


This version of UncountablePythonSDK might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: UncountablePythonSDK
3
- Version: 0.0.82
3
+ Version: 0.0.83
4
4
  Summary: Uncountable SDK
5
5
  Project-URL: Homepage, https://github.com/uncountableinc/uncountable-python-sdk
6
6
  Project-URL: Repository, https://github.com/uncountableinc/uncountable-python-sdk.git
@@ -106,7 +106,7 @@ uncountable/integration/queue_runner/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeu
106
106
  uncountable/integration/queue_runner/job_scheduler.py,sha256=lhvcl11jyk_wg9BSc1Xyh5u8iEtsdqQFW83FPLupjQI,6189
107
107
  uncountable/integration/queue_runner/queue_runner.py,sha256=0BmYu5zHdothTevGsB-nXg6MBd1UD-WkP3h1WCKMdQg,710
108
108
  uncountable/integration/queue_runner/types.py,sha256=8qTq29BTSa5rmW6CBlBntP0pNIiDcwu1wHa78pjroS0,219
109
- uncountable/integration/queue_runner/worker.py,sha256=EMDtdObowaq0aHndH1bBmlSIOih0jF3Gcn7Yl6NNeOM,4265
109
+ uncountable/integration/queue_runner/worker.py,sha256=WRh_EeGyCPr72v4QL17m6Iu-ipB3T0mhc7nulILf59E,4535
110
110
  uncountable/integration/queue_runner/command_server/__init__.py,sha256=gQPVILGpWzCr2i5GJyoqna7AOSFvtn4tav69gB78mTQ,571
111
111
  uncountable/integration/queue_runner/command_server/command_client.py,sha256=DJb0TUVFkiiLBEQzHSN94sTRnuEbutNEgdN39XmnOXI,2046
112
112
  uncountable/integration/queue_runner/command_server/command_server.py,sha256=yyXryhiEC2eGS0yFElLGsVzSKwOuYvj-zp22jQorkv0,2138
@@ -286,7 +286,7 @@ uncountable/types/api/triggers/__init__.py,sha256=gCgbynxG3jA8FQHzercKtrHKHkiIKr
286
286
  uncountable/types/api/triggers/run_trigger.py,sha256=-oZgPyn43xEKSCs81DVNzwaYMCdRJxbM9GY6fsqKwf4,1090
287
287
  uncountable/types/api/uploader/__init__.py,sha256=gCgbynxG3jA8FQHzercKtrHKHkiIKr8APdZYUniAor8,55
288
288
  uncountable/types/api/uploader/invoke_uploader.py,sha256=6mwVG136oLp9JcbB2I-kZnrcm3aeZzYZB-SFjEImY2o,1314
289
- UncountablePythonSDK-0.0.82.dist-info/METADATA,sha256=T6G_cXsagqxX7gJQ9ftG_gjKrByKf9ojWxpxFxHy1ZI,2051
290
- UncountablePythonSDK-0.0.82.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
291
- UncountablePythonSDK-0.0.82.dist-info/top_level.txt,sha256=1UVGjAU-6hJY9qw2iJ7nCBeEwZ793AEN5ZfKX9A1uj4,31
292
- UncountablePythonSDK-0.0.82.dist-info/RECORD,,
289
+ UncountablePythonSDK-0.0.83.dist-info/METADATA,sha256=ZyKbekQPHy3xFv8qqoVkAB5XWGyi8pX8XD15NY1GjIc,2051
290
+ UncountablePythonSDK-0.0.83.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
291
+ UncountablePythonSDK-0.0.83.dist-info/top_level.txt,sha256=1UVGjAU-6hJY9qw2iJ7nCBeEwZ793AEN5ZfKX9A1uj4,31
292
+ UncountablePythonSDK-0.0.83.dist-info/RECORD,,
@@ -2,6 +2,8 @@ import asyncio
2
2
  from concurrent.futures import ProcessPoolExecutor
3
3
  from dataclasses import dataclass
4
4
 
5
+ from opentelemetry.trace import get_current_span
6
+
5
7
  from uncountable.core.async_batch import AsyncBatchProcessor
6
8
  from uncountable.integration.construct_client import construct_uncountable_client
7
9
  from uncountable.integration.executors.executors import execute_job
@@ -9,7 +11,7 @@ from uncountable.integration.job import JobArguments
9
11
  from uncountable.integration.queue_runner.datastore.interface import Datastore
10
12
  from uncountable.integration.queue_runner.types import ListenQueue, ResultQueue
11
13
  from uncountable.integration.scan_profiles import load_profiles
12
- from uncountable.integration.telemetry import JobLogger, get_otel_tracer
14
+ from uncountable.integration.telemetry import JobLogger, Logger, get_otel_tracer
13
15
  from uncountable.types import base_t, job_definition_t, queued_job_t
14
16
 
15
17
 
@@ -28,19 +30,24 @@ class Worker:
28
30
  self.datastore = datastore
29
31
 
30
32
  async def run_worker_loop(self) -> None:
33
+ logger = Logger(get_current_span())
31
34
  while True:
32
- queued_job = await self.listen_queue.get()
33
- self.datastore.increment_num_attempts(queued_job.queued_job_uuid)
34
- loop = asyncio.get_event_loop()
35
- result = await loop.run_in_executor(
36
- self.process_pool, run_queued_job, queued_job
37
- )
38
- assert isinstance(result, job_definition_t.JobResult)
39
- await self.result_queue.put(
40
- queued_job_t.QueuedJobResult(
41
- job_result=result, queued_job_uuid=queued_job.queued_job_uuid
35
+ try:
36
+ queued_job = await self.listen_queue.get()
37
+ self.datastore.increment_num_attempts(queued_job.queued_job_uuid)
38
+ loop = asyncio.get_event_loop()
39
+ result = await loop.run_in_executor(
40
+ self.process_pool, run_queued_job, queued_job
42
41
  )
43
- )
42
+ assert isinstance(result, job_definition_t.JobResult)
43
+ await self.result_queue.put(
44
+ queued_job_t.QueuedJobResult(
45
+ job_result=result, queued_job_uuid=queued_job.queued_job_uuid
46
+ )
47
+ )
48
+ except BaseException as e:
49
+ logger.log_exception(e)
50
+ raise e
44
51
 
45
52
 
46
53
  @dataclass(kw_only=True)