osbot-utils 2.31.0__py3-none-any.whl → 2.32.0__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.
- osbot_utils/helpers/flows/Flow.py +5 -0
- osbot_utils/helpers/flows/actions/Flow__Stats__Collector.py +37 -1
- osbot_utils/version +1 -1
- {osbot_utils-2.31.0.dist-info → osbot_utils-2.32.0.dist-info}/METADATA +2 -2
- {osbot_utils-2.31.0.dist-info → osbot_utils-2.32.0.dist-info}/RECORD +7 -7
- {osbot_utils-2.31.0.dist-info → osbot_utils-2.32.0.dist-info}/LICENSE +0 -0
- {osbot_utils-2.31.0.dist-info → osbot_utils-2.32.0.dist-info}/WHEEL +0 -0
@@ -122,6 +122,11 @@ class Flow(Type_Safe):
|
|
122
122
|
def captured_logs(self):
|
123
123
|
return ansis_to_texts(self.captured_exec_logs)
|
124
124
|
|
125
|
+
def durations(self):
|
126
|
+
return self.flow_stats.durations()
|
127
|
+
|
128
|
+
def durations__with_tasks_status(self):
|
129
|
+
return self.flow_stats.durations__with_tasks_status()
|
125
130
|
|
126
131
|
async def invoke_flow_target__thread(self, flow): # this is a REALLY important method which is used to pin the flow object to the call stack
|
127
132
|
return await flow.flow_target(*flow.resolved_args, **flow.resolved_kwargs) # which is then used by the Task.find_flow method to find it
|
@@ -5,6 +5,7 @@ from osbot_utils.helpers.flows.schemas.Schema__Task__Stats import Schema__Task
|
|
5
5
|
from osbot_utils.helpers.flows.schemas.Schema__Flow__Stats import Schema__Flow__Stats
|
6
6
|
from osbot_utils.type_safe.Type_Safe import Type_Safe
|
7
7
|
|
8
|
+
FLOW__ERROR_MESSAGE__TASK_FAILED = 'At least one task failed'
|
8
9
|
|
9
10
|
class Flow__Stats__Collector(Type_Safe):
|
10
11
|
duration : Duration
|
@@ -31,6 +32,9 @@ class Flow__Stats__Collector(Type_Safe):
|
|
31
32
|
if flow_error:
|
32
33
|
_.status = Schema__Flow__Status.FAILED
|
33
34
|
_.error_message = str(flow_error)
|
35
|
+
elif _.failed_tasks:
|
36
|
+
_.status = Schema__Flow__Status.FAILED
|
37
|
+
_.error_message = FLOW__ERROR_MESSAGE__TASK_FAILED
|
34
38
|
else:
|
35
39
|
_.status = Schema__Flow__Status.COMPLETED
|
36
40
|
return self
|
@@ -44,4 +48,36 @@ class Flow__Stats__Collector(Type_Safe):
|
|
44
48
|
return self
|
45
49
|
|
46
50
|
def json(self): # Return JSON representation of the stats.
|
47
|
-
return self.stats.json()
|
51
|
+
return self.stats.json()
|
52
|
+
|
53
|
+
def durations__with_tasks_status(self):
|
54
|
+
with self.stats as _:
|
55
|
+
tasks_durations = dict()
|
56
|
+
flow_durations = dict(flow_name = _.flow_name ,
|
57
|
+
flow_duration = _.duration.duration_seconds,
|
58
|
+
flow_status = _.status.value ,
|
59
|
+
flow_tasks = tasks_durations )
|
60
|
+
|
61
|
+
for task_id, flow_task in self.stats.tasks_stats.items():
|
62
|
+
task_duration = dict(task_name = flow_task.task_name ,
|
63
|
+
task_duration = flow_task.duration.duration_seconds,
|
64
|
+
task_status = flow_task.status.value )
|
65
|
+
execution_order = flow_task.execution_order
|
66
|
+
tasks_durations[execution_order] = task_duration
|
67
|
+
return flow_durations
|
68
|
+
|
69
|
+
def durations(self):
|
70
|
+
with self.stats as _:
|
71
|
+
if _.status is None:
|
72
|
+
flow_durations = dict()
|
73
|
+
else:
|
74
|
+
tasks_durations = dict()
|
75
|
+
flow_durations = dict(flow_name = _.flow_name ,
|
76
|
+
flow_duration = _.duration.duration_seconds,
|
77
|
+
flow_status = _.status.value ,
|
78
|
+
flow_tasks = tasks_durations )
|
79
|
+
|
80
|
+
for task_id, flow_task in self.stats.tasks_stats.items():
|
81
|
+
|
82
|
+
tasks_durations[flow_task.task_name] = flow_task.duration.duration_seconds
|
83
|
+
return flow_durations
|
osbot_utils/version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
v2.
|
1
|
+
v2.32.0
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: osbot_utils
|
3
|
-
Version: 2.
|
3
|
+
Version: 2.32.0
|
4
4
|
Summary: OWASP Security Bot - Utils
|
5
5
|
License: MIT
|
6
6
|
Author: Dinis Cruz
|
@@ -23,7 +23,7 @@ Description-Content-Type: text/markdown
|
|
23
23
|
|
24
24
|
Powerful Python util methods and classes that simplify common apis and tasks.
|
25
25
|
|
26
|
-

|
27
27
|
[](https://codecov.io/gh/owasp-sbot/OSBot-Utils)
|
28
28
|
|
29
29
|
|
@@ -142,12 +142,12 @@ osbot_utils/helpers/duration/decorators/duration.py,sha256=ucJP1fCQEN8ALCDCG9CPz
|
|
142
142
|
osbot_utils/helpers/duration/decorators/print_duration.py,sha256=w7k3OPiRkL5KqLv0S5o1NVo2y_TeOOvDOb-51YbJjAc,283
|
143
143
|
osbot_utils/helpers/duration/schemas/Schema__Duration.py,sha256=-h32wBcpiVRkEbc_sZoamnRFNGaQQM4YsxqoVzPGe38,209
|
144
144
|
osbot_utils/helpers/duration/schemas/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
145
|
-
osbot_utils/helpers/flows/Flow.py,sha256=
|
145
|
+
osbot_utils/helpers/flows/Flow.py,sha256=2lsMliabGiNvfUW3S8mpfqt_fy4x0lRXLbn4hN1vUOQ,13828
|
146
146
|
osbot_utils/helpers/flows/Task.py,sha256=RfccOCev5XTsNoKuDJzK1JItF-Lm7P6FGCGZyh9swyY,7116
|
147
147
|
osbot_utils/helpers/flows/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
148
148
|
osbot_utils/helpers/flows/actions/Flow__Data.py,sha256=rgUggQo_z6KLtNa92KfzRG6ORdT_8ic5zJVuhk_st38,5064
|
149
149
|
osbot_utils/helpers/flows/actions/Flow__Events.py,sha256=g7KBafFeA7tV-v31v_m3MT__cZEX63gh8CehnZwRYU0,2840
|
150
|
-
osbot_utils/helpers/flows/actions/Flow__Stats__Collector.py,sha256=
|
150
|
+
osbot_utils/helpers/flows/actions/Flow__Stats__Collector.py,sha256=GCszqIGj8yVlr283ZXiejDCof-tbDgynjzAdmhEqBWg,4155
|
151
151
|
osbot_utils/helpers/flows/actions/Task__Stats__Collector.py,sha256=rDYABaHpikIAK0Odleu8-dZ9ECJZYDmgFdd0KvsbByI,1462
|
152
152
|
osbot_utils/helpers/flows/actions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
153
153
|
osbot_utils/helpers/flows/decorators/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -365,8 +365,8 @@ osbot_utils/utils/Toml.py,sha256=Rxl8gx7mni5CvBAK-Ai02EKw-GwtJdd3yeHT2kMloik,166
|
|
365
365
|
osbot_utils/utils/Version.py,sha256=Ww6ChwTxqp1QAcxOnztkTicShlcx6fbNsWX5xausHrg,422
|
366
366
|
osbot_utils/utils/Zip.py,sha256=pR6sKliUY0KZXmqNzKY2frfW-YVQEVbLKiyqQX_lc-8,14052
|
367
367
|
osbot_utils/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
368
|
-
osbot_utils/version,sha256=
|
369
|
-
osbot_utils-2.
|
370
|
-
osbot_utils-2.
|
371
|
-
osbot_utils-2.
|
372
|
-
osbot_utils-2.
|
368
|
+
osbot_utils/version,sha256=Xtxmpk2pLg4RSnFef8ZPZCvLkvPlYukwfufYx4QcYGE,8
|
369
|
+
osbot_utils-2.32.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
370
|
+
osbot_utils-2.32.0.dist-info/METADATA,sha256=PzZ7X2sewild0Lt65T2qSXnyl8ZDW-1BJ4I-BzX5ftU,1329
|
371
|
+
osbot_utils-2.32.0.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
|
372
|
+
osbot_utils-2.32.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|