holado 0.8.3__py3-none-any.whl → 0.9.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.
Potentially problematic release.
This version of holado might be problematic. Click here for more details.
- {holado-0.8.3.dist-info → holado-0.9.0.dist-info}/METADATA +1 -1
- {holado-0.8.3.dist-info → holado-0.9.0.dist-info}/RECORD +31 -16
- holado_core/common/resource/persisted_data_manager.py +10 -10
- holado_core/common/resource/resource_manager.py +34 -37
- holado_core/common/resource/table_data_manager.py +110 -0
- holado_core/common/tools/path_manager.py +30 -5
- holado_docker/tools/docker_controller/client/rest/docker_controller_client.py +2 -2
- holado_docker/tools/docker_controller/server/rest/api/os.py +6 -0
- holado_docker/tools/docker_controller/server/rest/openapi.yaml +4 -1
- holado_python/common/tools/datetime.py +7 -4
- holado_python/standard_library/ssl/resources/certificates/tcpbin.crt +16 -16
- holado_python/standard_library/ssl/resources/certificates/tcpbin.key +26 -26
- holado_report/__init__.py +1 -0
- holado_report/campaign/campaign_manager.py +189 -0
- holado_report/report/report_manager.py +2 -0
- holado_system/system/filesystem/file.py +5 -2
- holado_test/test_server/server/Dockerfile +70 -0
- holado_test/test_server/server/core/server_context.py +42 -0
- holado_test/test_server/server/core/server_manager.py +54 -0
- holado_test/test_server/server/requirements.txt +2 -0
- holado_test/test_server/server/rest/README +2 -0
- holado_test/test_server/server/rest/api/__init__.py +23 -0
- holado_test/test_server/server/rest/api/campaign/__init__.py +28 -0
- holado_test/test_server/server/rest/api/campaign/scenario.py +33 -0
- holado_test/test_server/server/rest/initialize_holado.py +72 -0
- holado_test/test_server/server/rest/logging.conf +50 -0
- holado_test/test_server/server/rest/openapi.yaml +46 -0
- holado_test/test_server/server/rest/run.py +40 -0
- holado_test/test_server/server/run_test_server_in_docker.sh +101 -0
- {holado-0.8.3.dist-info → holado-0.9.0.dist-info}/WHEEL +0 -0
- {holado-0.8.3.dist-info → holado-0.9.0.dist-info}/licenses/LICEN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s
|
|
26
|
+
2K8hd+B+0d6zB8WwvnO4H9gaO6OZleEOV3pVaCOMlDn6GE8UiQoS6JzUXk3+iW4j
|
|
27
|
+
jSA0Xr3pUFydKnSdlYLECucd
|
|
28
28
|
-----END PRIVATE KEY-----
|
holado_report/__init__.py
CHANGED
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
|
|
2
|
+
#################################################
|
|
3
|
+
# HolAdo (Holistic Automation do)
|
|
4
|
+
#
|
|
5
|
+
# (C) Copyright 2021-2025 by Eric Klumpp
|
|
6
|
+
#
|
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
8
|
+
#
|
|
9
|
+
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
10
|
+
|
|
11
|
+
# The Software is provided “as is”, without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the Software.
|
|
12
|
+
#################################################
|
|
13
|
+
|
|
14
|
+
from holado.common.context.session_context import SessionContext
|
|
15
|
+
import logging
|
|
16
|
+
from holado_core.common.resource.table_data_manager import TableDataManager
|
|
17
|
+
from holado_python.common.tools.datetime import DateTime
|
|
18
|
+
import os
|
|
19
|
+
from holado_system.system.filesystem.file import File
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
logger = logging.getLogger(__name__)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class CampaignManager(object):
|
|
27
|
+
""" Manage all campaigns
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
def __init__(self, db_name="campaigns"):
|
|
31
|
+
super().__init__()
|
|
32
|
+
|
|
33
|
+
self.__db_name = db_name
|
|
34
|
+
self.__resource_manager = None
|
|
35
|
+
|
|
36
|
+
self.__campaigns_table_manager = TableDataManager('campaign', 'campaigns', self.__get_campaigns_table_sql_create(), db_name=self.__db_name)
|
|
37
|
+
self.__campaign_scenarios_table_manager = TableDataManager('campaign scenario', 'campaign_scenarios', self.__get_campaign_scenarios_table_sql_create(), db_name=self.__db_name)
|
|
38
|
+
|
|
39
|
+
def initialize(self, resource_manager):
|
|
40
|
+
self.__resource_manager = resource_manager
|
|
41
|
+
|
|
42
|
+
self.__campaigns_table_manager.initialize(resource_manager)
|
|
43
|
+
self.__campaigns_table_manager.ensure_db_exists()
|
|
44
|
+
self.__campaign_scenarios_table_manager.initialize(resource_manager)
|
|
45
|
+
self.__campaign_scenarios_table_manager.ensure_db_exists()
|
|
46
|
+
|
|
47
|
+
def __get_db_client(self):
|
|
48
|
+
return self.__resource_manager.get_db_client(self.__db_name)
|
|
49
|
+
|
|
50
|
+
def __get_campaigns_table_sql_create(self):
|
|
51
|
+
return """CREATE TABLE campaigns (
|
|
52
|
+
id INTEGER PRIMARY KEY,
|
|
53
|
+
name TEXT NOT NULL,
|
|
54
|
+
report_path TEXT NOT NULL
|
|
55
|
+
)"""
|
|
56
|
+
|
|
57
|
+
def __get_campaign_scenarios_table_sql_create(self):
|
|
58
|
+
return """CREATE TABLE campaign_scenarios (
|
|
59
|
+
id INTEGER PRIMARY KEY,
|
|
60
|
+
campaign_id INTEGER NOT NULL,
|
|
61
|
+
name TEXT NOT NULL,
|
|
62
|
+
report_path TEXT,
|
|
63
|
+
status TEXT,
|
|
64
|
+
status_at TEXT,
|
|
65
|
+
details TEXT
|
|
66
|
+
)"""
|
|
67
|
+
|
|
68
|
+
def update_stored_campaigns(self):
|
|
69
|
+
""" Update stored reports in DB with new campaigns
|
|
70
|
+
"""
|
|
71
|
+
# Get report paths of campaigns to import
|
|
72
|
+
dt_last_camp = self.__get_last_campaign_scenario_status_datetime()
|
|
73
|
+
report_paths = self.__get_campaigns_report_paths(since_datetime=dt_last_camp)
|
|
74
|
+
|
|
75
|
+
# Sort reports in time order
|
|
76
|
+
report_paths = sorted(report_paths, key=lambda p: os.path.getmtime(os.path.join(p, 'report_summary_scenario_all.txt')))
|
|
77
|
+
logger.info(f"reports to import: {report_paths}", msg_size_limit=None)
|
|
78
|
+
|
|
79
|
+
# Import reports
|
|
80
|
+
for report_path in report_paths:
|
|
81
|
+
self.import_campaign_reports(report_path)
|
|
82
|
+
|
|
83
|
+
def __get_campaigns_report_paths(self, since_datetime):
|
|
84
|
+
reports_path = SessionContext.instance().path_manager.get_reports_path()
|
|
85
|
+
file_paths = SessionContext.instance().path_manager.find_files(reports_path, subdir_relative_path='report_summary_scenario_all.txt', since_datetime=since_datetime)
|
|
86
|
+
return [os.path.dirname(p) for p in file_paths]
|
|
87
|
+
|
|
88
|
+
def __get_last_campaign_scenario_status_datetime(self):
|
|
89
|
+
""" From stored campaigns, return the datetime of the last scenario with an execution status
|
|
90
|
+
"""
|
|
91
|
+
client = self.__get_db_client()
|
|
92
|
+
|
|
93
|
+
query_str = f'''
|
|
94
|
+
SELECT status_at
|
|
95
|
+
FROM campaign_scenarios
|
|
96
|
+
ORDER BY status_at DESC
|
|
97
|
+
LIMIT 1
|
|
98
|
+
'''
|
|
99
|
+
res_dict_list = client.execute(query_str, result_as_dict_list=True, as_generator=False)
|
|
100
|
+
|
|
101
|
+
status_dt_str = res_dict_list[0]['status_at'] if res_dict_list else None
|
|
102
|
+
status_dt = DateTime.str_2_datetime(status_dt_str) if status_dt_str else None
|
|
103
|
+
return status_dt
|
|
104
|
+
|
|
105
|
+
def import_campaign_reports(self, report_path):
|
|
106
|
+
""" Import reports of a campaign
|
|
107
|
+
@param report_path Path to the campaign report
|
|
108
|
+
"""
|
|
109
|
+
logger.info(f"Import campaign report '{report_path}'")
|
|
110
|
+
|
|
111
|
+
# Add campaign
|
|
112
|
+
camp_name = os.path.basename(report_path)
|
|
113
|
+
camp_id = self.add_campaign_if_needed(camp_name, report_path)
|
|
114
|
+
|
|
115
|
+
# Import scenario status
|
|
116
|
+
self.__import_campaign_report_summary_scenario_all(report_path, camp_id)
|
|
117
|
+
|
|
118
|
+
def get_scenario_history(self, scenario_name=None, size=None):
|
|
119
|
+
client = self.__get_db_client()
|
|
120
|
+
placeholder = client._get_sql_placeholder()
|
|
121
|
+
|
|
122
|
+
# Get data from DB
|
|
123
|
+
where_clause = ""
|
|
124
|
+
where_data = []
|
|
125
|
+
if scenario_name is not None:
|
|
126
|
+
where_clause = f"where name = {placeholder}"
|
|
127
|
+
where_data.append(scenario_name)
|
|
128
|
+
|
|
129
|
+
query_str = f'''
|
|
130
|
+
SELECT *
|
|
131
|
+
FROM campaign_scenarios
|
|
132
|
+
{where_clause}
|
|
133
|
+
ORDER BY name, status_at DESC
|
|
134
|
+
'''
|
|
135
|
+
camp_scenarios_gen = client.execute(query_str, *where_data, result_as_dict_list=True, as_generator=True)
|
|
136
|
+
|
|
137
|
+
# Build result
|
|
138
|
+
res = []
|
|
139
|
+
cur_scenario_name = None
|
|
140
|
+
cur_scenario_statuses = None
|
|
141
|
+
for cs in camp_scenarios_gen:
|
|
142
|
+
# Manage new scenario
|
|
143
|
+
if cur_scenario_name is None or cur_scenario_name != cs['name']:
|
|
144
|
+
cur_scenario_statuses = []
|
|
145
|
+
cur_scenario_name = cs['name']
|
|
146
|
+
res.append({'name':cur_scenario_name, 'statuses':cur_scenario_statuses})
|
|
147
|
+
|
|
148
|
+
# Add campaign info for this scenario execution if size limit is not reached
|
|
149
|
+
if size is None or len(cur_scenario_statuses) < size:
|
|
150
|
+
cur_scenario_statuses.append({'at':cs['status_at'], 'status':cs['status']})
|
|
151
|
+
|
|
152
|
+
return res
|
|
153
|
+
|
|
154
|
+
def add_campaign_if_needed(self, name, report_path):
|
|
155
|
+
filter_data = {'report_path': report_path}
|
|
156
|
+
if not self.__campaigns_table_manager.has_data(filter_data):
|
|
157
|
+
self.__campaigns_table_manager.add_data(filter_data, {'name': name})
|
|
158
|
+
camp = self.__campaigns_table_manager.get_data(filter_data)
|
|
159
|
+
return camp['id']
|
|
160
|
+
|
|
161
|
+
def update_or_add_campaign_scenario(self, campaign_id, name, *, report_path=None, status=None, status_at_str=None, details=None):
|
|
162
|
+
filter_data = {'campaign_id': campaign_id, 'name': name}
|
|
163
|
+
data = {}
|
|
164
|
+
if report_path is not None:
|
|
165
|
+
data['report_path'] = report_path
|
|
166
|
+
if status is not None:
|
|
167
|
+
data['status'] = status
|
|
168
|
+
if status_at_str is not None:
|
|
169
|
+
data['status_at'] = status_at_str
|
|
170
|
+
if details is not None:
|
|
171
|
+
data['details'] = details
|
|
172
|
+
|
|
173
|
+
self.__campaign_scenarios_table_manager.update_or_add_data(filter_data, data)
|
|
174
|
+
# camp_sce = self.__campaign_scenarios_table_manager.get_data(filter_data)
|
|
175
|
+
# return camp_sce['id']
|
|
176
|
+
|
|
177
|
+
def __import_campaign_report_summary_scenario_all(self, report_path, camp_id):
|
|
178
|
+
file_path = os.path.join(report_path, 'report_summary_scenario_all.txt')
|
|
179
|
+
lines = File(file_path, mode='rt').readlines(strip_newline=True)
|
|
180
|
+
|
|
181
|
+
for line in lines:
|
|
182
|
+
parts = line.split(' - ')
|
|
183
|
+
status_dt_str = parts[0]
|
|
184
|
+
scenario_name = parts[1]
|
|
185
|
+
status = parts[-1]
|
|
186
|
+
self.update_or_add_campaign_scenario(camp_id, scenario_name, status=status, status_at_str=status_dt_str)
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
|
|
@@ -81,8 +81,11 @@ class File(DeleteableObject):
|
|
|
81
81
|
def readline(self, limit: int = -1) -> AnyStr:
|
|
82
82
|
return self.internal_file.readline(limit)
|
|
83
83
|
|
|
84
|
-
def readlines(self, hint: int = -1) -> List[AnyStr]:
|
|
85
|
-
|
|
84
|
+
def readlines(self, hint: int = -1, strip_newline=False) -> List[AnyStr]:
|
|
85
|
+
res = self.internal_file.readlines(hint)
|
|
86
|
+
if strip_newline:
|
|
87
|
+
res = [l.strip('\n') for l in res]
|
|
88
|
+
return res
|
|
86
89
|
|
|
87
90
|
|
|
88
91
|
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
### Build
|
|
2
|
+
|
|
3
|
+
#FROM python:3.12.9-alpine3.21 AS build
|
|
4
|
+
FROM python:3.12.11-alpine3.22 AS build
|
|
5
|
+
|
|
6
|
+
# Install to build python requirements
|
|
7
|
+
RUN apk update \
|
|
8
|
+
&& apk --no-cache --update add build-base \
|
|
9
|
+
&& apk --update add alpine-sdk \
|
|
10
|
+
&& apk add libffi-dev \
|
|
11
|
+
&& apk add postgresql-dev gcc python3-dev musl-dev \
|
|
12
|
+
&& apk add protobuf-dev
|
|
13
|
+
|
|
14
|
+
# Add tools
|
|
15
|
+
RUN apk --no-cache add bash \
|
|
16
|
+
&& apk --no-cache add nano \
|
|
17
|
+
&& apk --no-cache add curl
|
|
18
|
+
|
|
19
|
+
# Create user
|
|
20
|
+
RUN addgroup appuser \
|
|
21
|
+
&& adduser -G appuser -s /bin/bash -D appuser
|
|
22
|
+
|
|
23
|
+
# Create /code folder
|
|
24
|
+
RUN mkdir /code \
|
|
25
|
+
&& chown -R appuser:appuser /code
|
|
26
|
+
|
|
27
|
+
# Switch to user appuser
|
|
28
|
+
USER appuser
|
|
29
|
+
|
|
30
|
+
# Create python venv and install requirements
|
|
31
|
+
COPY --chown=appuser ./requirements.txt /code/test_server/requirements.txt
|
|
32
|
+
WORKDIR /code/test_server
|
|
33
|
+
RUN python -m venv /code/env \
|
|
34
|
+
&& source /code/env/bin/activate \
|
|
35
|
+
&& pip install -r requirements.txt
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
### Runtime
|
|
40
|
+
|
|
41
|
+
#FROM python:3.12.9-alpine3.21 AS runtime
|
|
42
|
+
FROM python:3.12.11-alpine3.22 AS runtime
|
|
43
|
+
|
|
44
|
+
# Install for python requirements
|
|
45
|
+
#RUN apk update \
|
|
46
|
+
# && apk --no-cache add libstdc++ \
|
|
47
|
+
# && apk --no-cache add postgresql-dev gcc python3-dev musl-dev
|
|
48
|
+
|
|
49
|
+
# Add tools
|
|
50
|
+
RUN apk --no-cache add bash \
|
|
51
|
+
&& apk --no-cache add nano \
|
|
52
|
+
&& apk --no-cache add curl
|
|
53
|
+
|
|
54
|
+
# Create and switch to user appuser as in build
|
|
55
|
+
RUN addgroup appuser \
|
|
56
|
+
&& adduser -G appuser -s /bin/bash -D appuser
|
|
57
|
+
USER appuser
|
|
58
|
+
|
|
59
|
+
# Copy /code from build
|
|
60
|
+
COPY --chown=appuser --from=build /code /code
|
|
61
|
+
|
|
62
|
+
# Copy docker controller sources
|
|
63
|
+
COPY --chown=appuser ./rest /code/test_server
|
|
64
|
+
|
|
65
|
+
# Activate permanently python venv
|
|
66
|
+
ENV PATH=/code/env/bin:$PATH
|
|
67
|
+
|
|
68
|
+
WORKDIR /code/test_server
|
|
69
|
+
CMD ["sh", "-c", "uvicorn run:app --host 0.0.0.0 --port $HOLADO_TEST_SERVER_PORT"]
|
|
70
|
+
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
from builtins import super
|
|
2
|
+
from holado.common.context.session_context import SessionContext
|
|
3
|
+
import logging
|
|
4
|
+
|
|
5
|
+
logger = logging.getLogger(__name__)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class TestServerSessionContext(SessionContext):
|
|
9
|
+
|
|
10
|
+
def __init__(self):
|
|
11
|
+
super().__init__("TestServerSession")
|
|
12
|
+
|
|
13
|
+
def configure(self, session_kwargs=None):
|
|
14
|
+
logger.info("Configuring TestServerSessionContext")
|
|
15
|
+
|
|
16
|
+
super().configure(session_kwargs)
|
|
17
|
+
|
|
18
|
+
# Override default registered modules
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
# Register new modules
|
|
23
|
+
|
|
24
|
+
from holado_test.test_server.server.core.server_manager import TestServerManager
|
|
25
|
+
self.services.register_service_type("server_manager", TestServerManager,
|
|
26
|
+
lambda m: m.initialize(self.resource_manager) )
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def initialize(self, session_kwargs=None):
|
|
31
|
+
if session_kwargs is None:
|
|
32
|
+
session_kwargs = {}
|
|
33
|
+
# raise_if_not_exist = session_kwargs.get("raise_if_not_exist", True)
|
|
34
|
+
# do_import = session_kwargs.get("import_compiled_proto", True)
|
|
35
|
+
|
|
36
|
+
# Call default initialization
|
|
37
|
+
super().initialize(session_kwargs)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
|
|
2
|
+
#################################################
|
|
3
|
+
# HolAdo (Holistic Automation do)
|
|
4
|
+
#
|
|
5
|
+
# (C) Copyright 2021-2025 by Eric Klumpp
|
|
6
|
+
#
|
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
8
|
+
#
|
|
9
|
+
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
10
|
+
|
|
11
|
+
# The Software is provided “as is”, without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the Software.
|
|
12
|
+
#################################################
|
|
13
|
+
|
|
14
|
+
from holado.common.context.session_context import SessionContext
|
|
15
|
+
from behave.model_core import Status
|
|
16
|
+
from holado_core.common.tools.tools import Tools
|
|
17
|
+
import logging
|
|
18
|
+
# from holado_report.report.builders.json_execution_historic_report_builder import JsonExecutionHistoricReportBuilder
|
|
19
|
+
from holado_report.report.builders.detailed_scenario_failed_report_builder import DetailedScenarioFailedReportBuilder
|
|
20
|
+
from holado_report.report.builders.summary_report_builder import SummaryReportBuilder
|
|
21
|
+
from holado_report.report.builders.summary_scenario_failed_report_builder import SummaryScenarioFailedReportBuilder
|
|
22
|
+
from holado_report.report.builders.short_scenario_failed_report_builder import ShortScenarioFailedReportBuilder
|
|
23
|
+
from holado_report.report.reports.base_report import BaseReport
|
|
24
|
+
from holado_scripting.common.tools.evaluate_parameters import EvaluateParameters
|
|
25
|
+
from holado_report.report.builders.summary_scenario_report_builder import SummaryScenarioReportBuilder
|
|
26
|
+
from holado_report.report.builders.failure_report_builder import FailureReportBuilder
|
|
27
|
+
from holado_report.campaign.campaign_manager import CampaignManager
|
|
28
|
+
# from holado_core.scenario.scenario_duration_manager import ScenarioDurationManager
|
|
29
|
+
|
|
30
|
+
logger = logging.getLogger(__name__)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class TestServerManager(object):
|
|
36
|
+
""" Manage test server
|
|
37
|
+
"""
|
|
38
|
+
|
|
39
|
+
def __init__(self):
|
|
40
|
+
super().__init__()
|
|
41
|
+
|
|
42
|
+
self.__campaign_manager = CampaignManager(db_name="server/campaigns")
|
|
43
|
+
|
|
44
|
+
def initialize(self, resource_manager):
|
|
45
|
+
self.__campaign_manager.initialize(resource_manager)
|
|
46
|
+
|
|
47
|
+
@property
|
|
48
|
+
def campaign_manager(self):
|
|
49
|
+
return self.__campaign_manager
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#################################################
|
|
2
|
+
# HolAdo (Holistic Automation do)
|
|
3
|
+
#
|
|
4
|
+
# (C) Copyright 2021-2025 by Eric Klumpp
|
|
5
|
+
#
|
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
7
|
+
#
|
|
8
|
+
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
9
|
+
|
|
10
|
+
# The Software is provided “as is”, without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the Software.
|
|
11
|
+
#################################################
|
|
12
|
+
|
|
13
|
+
from flask.views import MethodView
|
|
14
|
+
from holado.common.context.session_context import SessionContext
|
|
15
|
+
import logging
|
|
16
|
+
|
|
17
|
+
logger = logging.getLogger(__name__)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def _get_session_context():
|
|
22
|
+
return SessionContext.instance()
|
|
23
|
+
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#################################################
|
|
2
|
+
# HolAdo (Holistic Automation do)
|
|
3
|
+
#
|
|
4
|
+
# (C) Copyright 2021-2025 by Eric Klumpp
|
|
5
|
+
#
|
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
7
|
+
#
|
|
8
|
+
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
9
|
+
|
|
10
|
+
# The Software is provided “as is”, without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the Software.
|
|
11
|
+
#################################################
|
|
12
|
+
|
|
13
|
+
from flask.views import MethodView
|
|
14
|
+
from holado.common.context.session_context import SessionContext
|
|
15
|
+
import logging
|
|
16
|
+
|
|
17
|
+
logger = logging.getLogger(__name__)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def _get_session_context():
|
|
21
|
+
return SessionContext.instance()
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class UpdateView(MethodView):
|
|
25
|
+
|
|
26
|
+
def put(self):
|
|
27
|
+
_get_session_context().server_manager.campaign_manager.update_stored_campaigns()
|
|
28
|
+
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#################################################
|
|
2
|
+
# HolAdo (Holistic Automation do)
|
|
3
|
+
#
|
|
4
|
+
# (C) Copyright 2021-2025 by Eric Klumpp
|
|
5
|
+
#
|
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
7
|
+
#
|
|
8
|
+
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
9
|
+
|
|
10
|
+
# The Software is provided “as is”, without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the Software.
|
|
11
|
+
#################################################
|
|
12
|
+
|
|
13
|
+
from flask.views import MethodView
|
|
14
|
+
from holado.common.context.session_context import SessionContext
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def _get_session_context():
|
|
18
|
+
return SessionContext.instance()
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class HistoryView(MethodView):
|
|
22
|
+
|
|
23
|
+
def get(self, body: dict):
|
|
24
|
+
scenario_name = body.get('scenario_name') if body else None
|
|
25
|
+
size = body.get('size') if body else None
|
|
26
|
+
|
|
27
|
+
res = _get_session_context().server_manager.campaign_manager.get_scenario_history(scenario_name=scenario_name, size=size)
|
|
28
|
+
return res
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
|
|
2
|
+
#################################################
|
|
3
|
+
# HolAdo (Holistic Automation do)
|
|
4
|
+
#
|
|
5
|
+
# (C) Copyright 2021-2025 by Eric Klumpp
|
|
6
|
+
#
|
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
8
|
+
#
|
|
9
|
+
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
10
|
+
|
|
11
|
+
# The Software is provided “as is”, without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the Software.
|
|
12
|
+
#################################################
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
#################################################
|
|
16
|
+
# GOAL: Tools when using a clone of HolAdo project.
|
|
17
|
+
#
|
|
18
|
+
# This file contains methods usefull to initialize environments using a clone of HolAdo project.
|
|
19
|
+
#
|
|
20
|
+
# USAGE:
|
|
21
|
+
# - Copy this file in projects using HolAdo.
|
|
22
|
+
# - Define environment variable HOLADO_PATH with path to cloned HolAdo project.
|
|
23
|
+
# If HOLADO_PATH is defined, sources of cloned HolAdo project are used, else installed holado package is used.
|
|
24
|
+
#################################################
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
import os
|
|
29
|
+
import sys
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def insert_sys_path(path, index=0):
|
|
33
|
+
"""Insert a path in sys.path if it doesn't already exists.
|
|
34
|
+
"""
|
|
35
|
+
if path not in sys.path:
|
|
36
|
+
sys.path.insert(index, path)
|
|
37
|
+
|
|
38
|
+
def insert_sys_paths(list_paths, index=0):
|
|
39
|
+
"""Insert a list of path in sys.path if it doesn't already exists.
|
|
40
|
+
"""
|
|
41
|
+
if list_paths:
|
|
42
|
+
for path in list_paths:
|
|
43
|
+
insert_sys_path(path, index=index)
|
|
44
|
+
|
|
45
|
+
def insert_holado_source_paths(with_test_behave=True):
|
|
46
|
+
"""Insert in sys.path all HolAdo source paths.
|
|
47
|
+
If environment variable HOLADO_PATH is defined with path to HolAdo project, following paths are inserted in sys.path:
|
|
48
|
+
- HOLADO_PATH/src: path to holado modules sources
|
|
49
|
+
- HOLADO_PATH/tests/behave (if with_test_behave==True): path to holado test sources, needed by testing solutions
|
|
50
|
+
"""
|
|
51
|
+
holado_path = os.getenv('HOLADO_PATH')
|
|
52
|
+
if holado_path is None:
|
|
53
|
+
try:
|
|
54
|
+
import holado # @UnusedImport
|
|
55
|
+
except Exception as exc:
|
|
56
|
+
if "No module named" in str(exc):
|
|
57
|
+
raise Exception(f"If environment variable HOLADO_PATH is not defined with path to HolAdo project, 'holado' python package must be installed")
|
|
58
|
+
else:
|
|
59
|
+
raise exc
|
|
60
|
+
else:
|
|
61
|
+
# holado is installed, and all sources are already accessible
|
|
62
|
+
pass
|
|
63
|
+
else:
|
|
64
|
+
print(f"Using HolAdo project installed in '{holado_path}'")
|
|
65
|
+
# import traceback
|
|
66
|
+
# print("".join(traceback.format_list(traceback.extract_stack())))
|
|
67
|
+
# insert_sys_path(holado_path)
|
|
68
|
+
insert_sys_path(os.path.join(holado_path, "src"))
|
|
69
|
+
if with_test_behave:
|
|
70
|
+
insert_sys_path(os.path.join(holado_path, "tests", "behave"))
|
|
71
|
+
|
|
72
|
+
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
[holado]
|
|
2
|
+
level=INFO
|
|
3
|
+
#level=DEBUG
|
|
4
|
+
#level=TRACE
|
|
5
|
+
log_on_console=False
|
|
6
|
+
#log_on_console=True
|
|
7
|
+
log_in_file=True
|
|
8
|
+
#log_in_file=False
|
|
9
|
+
|
|
10
|
+
[loggers_levels]
|
|
11
|
+
holado=INFO
|
|
12
|
+
#holado=DEBUG
|
|
13
|
+
#holado.common.context=INFO
|
|
14
|
+
#holado.common.context.session_context=DEBUG
|
|
15
|
+
holado_core.common.block.scope_manager=INFO
|
|
16
|
+
#holado_core.common.handlers=TRACE
|
|
17
|
+
#holado_core.common.tools=DEBUG
|
|
18
|
+
holado_core.common.tools.comparators=INFO
|
|
19
|
+
#holado_core.common.tools.tools=TRACE
|
|
20
|
+
holado_db.tools=DEBUG
|
|
21
|
+
holado_logging=INFO
|
|
22
|
+
holado_multitask=WARNING
|
|
23
|
+
#holado_multitask.multitasking.multitask_manager=TRACE
|
|
24
|
+
#holado_protobuf.ipc.protobuf=DEBUG
|
|
25
|
+
#holado_protobuf.ipc.protobuf.protobuf_messages=TRACE
|
|
26
|
+
#holado_python.standard_library.socket=DEBUG
|
|
27
|
+
#holado_rest.api/rest=DEBUG
|
|
28
|
+
#holado_value.common.tables.value_table_cell=TRACE
|
|
29
|
+
holado_s3.tools.s3.minio_client.trace=INFO
|
|
30
|
+
|
|
31
|
+
#holado_scripting.common.tools=DEBUG
|
|
32
|
+
#holado_scripting.common.tools.expression_evaluator=DEBUG
|
|
33
|
+
#holado_scripting.common.tools.expression_evaluator=TRACE
|
|
34
|
+
#holado_scripting.common.tools.variable_manager=TRACE
|
|
35
|
+
#holado_scripting.text.interpreter=TRACE
|
|
36
|
+
|
|
37
|
+
#holado_system=DEBUG
|
|
38
|
+
#holado_test.behave.behave=DEBUG
|
|
39
|
+
#holado_yaml=DEBUG
|
|
40
|
+
|
|
41
|
+
# External libraries
|
|
42
|
+
chardet=WARNING
|
|
43
|
+
pika=WARNING
|
|
44
|
+
psycopg=INFO
|
|
45
|
+
ssl=DEBUG
|
|
46
|
+
suds.transport=DEBUG
|
|
47
|
+
subprocess=DEBUG
|
|
48
|
+
urllib3=INFO
|
|
49
|
+
zeep.transports=DEBUG
|
|
50
|
+
|