pyxecm 2.0.3__py3-none-any.whl → 3.0.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 pyxecm might be problematic. Click here for more details.
- pyxecm/coreshare.py +76 -8
- pyxecm/helper/data.py +16 -24
- pyxecm/helper/otel_config.py +26 -0
- pyxecm/helper/web.py +1 -2
- pyxecm/otca.py +1356 -16
- pyxecm/otcs.py +4238 -758
- pyxecm/otds.py +4 -12
- pyxecm/otmm.py +4 -5
- pyxecm/py.typed +0 -0
- pyxecm-3.0.0.dist-info/METADATA +48 -0
- pyxecm-3.0.0.dist-info/RECORD +96 -0
- {pyxecm-2.0.3.dist-info → pyxecm-3.0.0.dist-info}/WHEEL +1 -2
- pyxecm-3.0.0.dist-info/entry_points.txt +4 -0
- {pyxecm/customizer/api → pyxecm_api}/__main__.py +1 -1
- pyxecm_api/agents/__init__.py +7 -0
- pyxecm_api/agents/app.py +13 -0
- pyxecm_api/agents/functions.py +119 -0
- pyxecm_api/agents/models.py +10 -0
- pyxecm_api/agents/otcm_knowledgegraph/functions.py +85 -0
- pyxecm_api/agents/otcm_knowledgegraph/models.py +61 -0
- pyxecm_api/agents/otcm_knowledgegraph/router.py +74 -0
- pyxecm_api/agents/otcm_user_agent/models.py +20 -0
- pyxecm_api/agents/otcm_user_agent/router.py +65 -0
- pyxecm_api/agents/otcm_workspace_agent/models.py +40 -0
- pyxecm_api/agents/otcm_workspace_agent/router.py +200 -0
- pyxecm_api/app.py +221 -0
- {pyxecm/customizer/api → pyxecm_api}/auth/functions.py +10 -2
- {pyxecm/customizer/api → pyxecm_api}/auth/router.py +4 -3
- {pyxecm/customizer/api → pyxecm_api}/common/functions.py +39 -9
- {pyxecm/customizer/api → pyxecm_api}/common/metrics.py +1 -2
- {pyxecm/customizer/api → pyxecm_api}/common/router.py +12 -11
- {pyxecm/customizer/api → pyxecm_api}/settings.py +30 -6
- {pyxecm/customizer/api → pyxecm_api}/terminal/router.py +1 -1
- {pyxecm/customizer/api → pyxecm_api}/v1_csai/router.py +39 -10
- pyxecm_api/v1_csai/statics/bindings/utils.js +189 -0
- pyxecm_api/v1_csai/statics/tom-select/tom-select.complete.min.js +356 -0
- pyxecm_api/v1_csai/statics/tom-select/tom-select.css +334 -0
- pyxecm_api/v1_csai/statics/vis-9.1.2/vis-network.css +1 -0
- pyxecm_api/v1_csai/statics/vis-9.1.2/vis-network.min.js +27 -0
- pyxecm_api/v1_maintenance/__init__.py +1 -0
- {pyxecm/customizer/api → pyxecm_api}/v1_maintenance/functions.py +3 -3
- {pyxecm/customizer/api → pyxecm_api}/v1_maintenance/router.py +8 -8
- pyxecm_api/v1_otcs/__init__.py +1 -0
- {pyxecm/customizer/api → pyxecm_api}/v1_otcs/functions.py +7 -5
- {pyxecm/customizer/api → pyxecm_api}/v1_otcs/router.py +24 -13
- pyxecm_api/v1_payload/__init__.py +1 -0
- {pyxecm/customizer/api → pyxecm_api}/v1_payload/functions.py +10 -7
- {pyxecm/customizer/api → pyxecm_api}/v1_payload/router.py +11 -10
- {pyxecm/customizer → pyxecm_customizer}/__init__.py +8 -0
- {pyxecm/customizer → pyxecm_customizer}/__main__.py +15 -21
- {pyxecm/customizer → pyxecm_customizer}/browser_automation.py +414 -103
- {pyxecm/customizer → pyxecm_customizer}/customizer.py +178 -116
- {pyxecm/customizer → pyxecm_customizer}/guidewire.py +60 -20
- {pyxecm/customizer → pyxecm_customizer}/k8s.py +4 -4
- pyxecm_customizer/knowledge_graph.py +719 -0
- pyxecm_customizer/log.py +35 -0
- {pyxecm/customizer → pyxecm_customizer}/m365.py +41 -33
- {pyxecm/customizer → pyxecm_customizer}/payload.py +2359 -1991
- {pyxecm/customizer/api/common → pyxecm_customizer}/payload_list.py +57 -65
- {pyxecm/customizer → pyxecm_customizer}/salesforce.py +1 -1
- {pyxecm/customizer → pyxecm_customizer}/sap.py +6 -2
- {pyxecm/customizer → pyxecm_customizer}/servicenow.py +2 -4
- {pyxecm/customizer → pyxecm_customizer}/settings.py +7 -6
- {pyxecm/customizer → pyxecm_customizer}/successfactors.py +40 -28
- {pyxecm/customizer → pyxecm_customizer}/translate.py +14 -10
- {pyxecm/maintenance_page → pyxecm_maintenance_page}/__main__.py +1 -1
- {pyxecm/maintenance_page → pyxecm_maintenance_page}/app.py +16 -6
- pyxecm/customizer/api/app.py +0 -163
- pyxecm/customizer/log.py +0 -107
- pyxecm/customizer/nhc.py +0 -1169
- pyxecm/customizer/openapi.py +0 -258
- pyxecm/customizer/pht.py +0 -1357
- pyxecm-2.0.3.dist-info/METADATA +0 -119
- pyxecm-2.0.3.dist-info/RECORD +0 -78
- pyxecm-2.0.3.dist-info/licenses/LICENSE +0 -202
- pyxecm-2.0.3.dist-info/top_level.txt +0 -1
- {pyxecm/customizer/api → pyxecm_api}/__init__.py +0 -0
- {pyxecm/customizer/api/auth → pyxecm_api/agents/otcm_knowledgegraph}/__init__.py +0 -0
- {pyxecm/customizer/api/common → pyxecm_api/agents/otcm_user_agent}/__init__.py +0 -0
- {pyxecm/customizer/api/v1_csai → pyxecm_api/agents/otcm_workspace_agent}/__init__.py +0 -0
- {pyxecm/customizer/api/v1_maintenance → pyxecm_api/auth}/__init__.py +0 -0
- {pyxecm/customizer/api → pyxecm_api}/auth/models.py +0 -0
- {pyxecm/customizer/api/v1_otcs → pyxecm_api/common}/__init__.py +0 -0
- {pyxecm/customizer/api → pyxecm_api}/common/models.py +0 -0
- {pyxecm/customizer/api → pyxecm_api}/terminal/__init__.py +0 -0
- {pyxecm/customizer/api/v1_payload → pyxecm_api/v1_csai}/__init__.py +0 -0
- {pyxecm/customizer/api → pyxecm_api}/v1_csai/models.py +0 -0
- {pyxecm/customizer/api → pyxecm_api}/v1_maintenance/models.py +0 -0
- {pyxecm/customizer/api → pyxecm_api}/v1_payload/models.py +0 -0
- {pyxecm/customizer → pyxecm_customizer}/exceptions.py +0 -0
- {pyxecm/maintenance_page → pyxecm_maintenance_page}/__init__.py +0 -0
- {pyxecm/maintenance_page → pyxecm_maintenance_page}/settings.py +0 -0
- {pyxecm/maintenance_page → pyxecm_maintenance_page}/static/favicon.avif +0 -0
- {pyxecm/maintenance_page → pyxecm_maintenance_page}/templates/maintenance.html +0 -0
pyxecm/customizer/api/app.py
DELETED
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
"""API Implemenation for the Customizer to start and control the payload processing."""
|
|
2
|
-
|
|
3
|
-
__author__ = "Dr. Marc Diefenbruch"
|
|
4
|
-
__copyright__ = "Copyright (C) 2024-2025, OpenText"
|
|
5
|
-
__credits__ = ["Kai-Philip Gatzweiler"]
|
|
6
|
-
__maintainer__ = "Dr. Marc Diefenbruch"
|
|
7
|
-
__email__ = "mdiefenb@opentext.com"
|
|
8
|
-
|
|
9
|
-
import logging
|
|
10
|
-
import os
|
|
11
|
-
import sys
|
|
12
|
-
from collections.abc import AsyncGenerator
|
|
13
|
-
from contextlib import asynccontextmanager
|
|
14
|
-
from datetime import datetime, timezone
|
|
15
|
-
from importlib.metadata import version
|
|
16
|
-
from threading import Thread
|
|
17
|
-
|
|
18
|
-
import uvicorn
|
|
19
|
-
from fastapi import FastAPI
|
|
20
|
-
from fastapi.middleware.cors import CORSMiddleware
|
|
21
|
-
from prometheus_fastapi_instrumentator import Instrumentator
|
|
22
|
-
|
|
23
|
-
from pyxecm.customizer.api.auth.router import router as auth_router
|
|
24
|
-
from pyxecm.customizer.api.common.functions import PAYLOAD_LIST
|
|
25
|
-
from pyxecm.customizer.api.common.metrics import payload_logs_by_payload, payload_logs_total
|
|
26
|
-
from pyxecm.customizer.api.common.router import router as common_router
|
|
27
|
-
from pyxecm.customizer.api.settings import api_settings
|
|
28
|
-
from pyxecm.customizer.api.terminal.router import router as terminal_router
|
|
29
|
-
from pyxecm.customizer.api.v1_csai.router import router as v1_csai_router
|
|
30
|
-
from pyxecm.customizer.api.v1_maintenance.router import router as v1_maintenance_router
|
|
31
|
-
from pyxecm.customizer.api.v1_otcs.router import router as v1_otcs_router
|
|
32
|
-
from pyxecm.customizer.api.v1_payload.functions import import_payload
|
|
33
|
-
from pyxecm.customizer.api.v1_payload.router import router as v1_payload_router
|
|
34
|
-
from pyxecm.maintenance_page import run_maintenance_page
|
|
35
|
-
|
|
36
|
-
# Check if Temp dir exists
|
|
37
|
-
if not os.path.exists(api_settings.temp_dir):
|
|
38
|
-
os.makedirs(api_settings.temp_dir)
|
|
39
|
-
|
|
40
|
-
# Check if Logfile and folder exists and is unique
|
|
41
|
-
if os.path.isfile(os.path.join(api_settings.logfolder, api_settings.logfile)):
|
|
42
|
-
customizer_start_time = datetime.now(timezone.utc).strftime(
|
|
43
|
-
"%Y-%m-%d_%H-%M",
|
|
44
|
-
)
|
|
45
|
-
api_settings.logfile = f"customizer_{customizer_start_time}.log"
|
|
46
|
-
elif not os.path.exists(api_settings.logfolder):
|
|
47
|
-
os.makedirs(api_settings.logfolder)
|
|
48
|
-
|
|
49
|
-
handlers = [
|
|
50
|
-
logging.FileHandler(os.path.join(api_settings.logfolder, api_settings.logfile)),
|
|
51
|
-
logging.StreamHandler(sys.stdout),
|
|
52
|
-
]
|
|
53
|
-
|
|
54
|
-
logging.basicConfig(
|
|
55
|
-
format="%(asctime)s %(levelname)s [%(name)s] [%(threadName)s] %(message)s",
|
|
56
|
-
datefmt="%d-%b-%Y %H:%M:%S",
|
|
57
|
-
level=api_settings.loglevel,
|
|
58
|
-
handlers=handlers,
|
|
59
|
-
)
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
@asynccontextmanager
|
|
63
|
-
async def lifespan(
|
|
64
|
-
app: FastAPI, # noqa: ARG001
|
|
65
|
-
) -> AsyncGenerator:
|
|
66
|
-
"""Lifespan Method for FASTAPI to handle the startup and shutdown process.
|
|
67
|
-
|
|
68
|
-
Args:
|
|
69
|
-
app (FastAPI):
|
|
70
|
-
The application.
|
|
71
|
-
|
|
72
|
-
"""
|
|
73
|
-
|
|
74
|
-
logger.debug("Settings -> %s", api_settings)
|
|
75
|
-
|
|
76
|
-
if api_settings.import_payload:
|
|
77
|
-
logger.info("Importing filesystem payloads...")
|
|
78
|
-
|
|
79
|
-
# Base Payload
|
|
80
|
-
import_payload(payload=api_settings.payload)
|
|
81
|
-
|
|
82
|
-
# External Payload
|
|
83
|
-
import_payload(payload_dir=api_settings.payload_dir, dependencies=True)
|
|
84
|
-
|
|
85
|
-
# Optional Payload
|
|
86
|
-
import_payload(payload_dir=api_settings.payload_dir_optional)
|
|
87
|
-
|
|
88
|
-
if api_settings.maintenance_mode:
|
|
89
|
-
logger.info("Starting maintenance_page thread...")
|
|
90
|
-
maint_thread = Thread(target=run_maintenance_page, name="maintenance_page")
|
|
91
|
-
maint_thread.start()
|
|
92
|
-
|
|
93
|
-
logger.info("Starting processing thread...")
|
|
94
|
-
thread = Thread(
|
|
95
|
-
target=PAYLOAD_LIST.run_payload_processing,
|
|
96
|
-
name="customization_run_api",
|
|
97
|
-
)
|
|
98
|
-
thread.start()
|
|
99
|
-
|
|
100
|
-
yield
|
|
101
|
-
logger.info("Shutdown")
|
|
102
|
-
PAYLOAD_LIST.stop_payload_processing()
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
app = FastAPI(
|
|
106
|
-
docs_url="/api",
|
|
107
|
-
title="Customizer API",
|
|
108
|
-
openapi_url=api_settings.openapi_url,
|
|
109
|
-
root_path=api_settings.root_path,
|
|
110
|
-
lifespan=lifespan,
|
|
111
|
-
version=version("pyxecm"),
|
|
112
|
-
openapi_tags=[
|
|
113
|
-
{
|
|
114
|
-
"name": "auth",
|
|
115
|
-
"description": "Authentication Endpoint - Users are authenticated against Opentext Directory Services",
|
|
116
|
-
},
|
|
117
|
-
{
|
|
118
|
-
"name": "payload",
|
|
119
|
-
"description": "Get status and manipulate payload objects ",
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
"name": "maintenance",
|
|
123
|
-
"description": "Enable, disable or alter the maintenance mode.",
|
|
124
|
-
},
|
|
125
|
-
],
|
|
126
|
-
)
|
|
127
|
-
|
|
128
|
-
## Add all Routers
|
|
129
|
-
app.include_router(router=common_router)
|
|
130
|
-
app.include_router(router=auth_router)
|
|
131
|
-
app.include_router(router=v1_maintenance_router)
|
|
132
|
-
app.include_router(router=v1_otcs_router)
|
|
133
|
-
app.include_router(router=v1_payload_router)
|
|
134
|
-
if api_settings.ws_terminal:
|
|
135
|
-
app.include_router(router=terminal_router)
|
|
136
|
-
if api_settings.csai:
|
|
137
|
-
app.include_router(router=v1_csai_router)
|
|
138
|
-
|
|
139
|
-
logger = logging.getLogger("CustomizerAPI")
|
|
140
|
-
app.add_middleware(
|
|
141
|
-
CORSMiddleware,
|
|
142
|
-
allow_origins=api_settings.trusted_origins,
|
|
143
|
-
allow_credentials=True,
|
|
144
|
-
allow_methods=["*"],
|
|
145
|
-
allow_headers=["*"],
|
|
146
|
-
)
|
|
147
|
-
|
|
148
|
-
if api_settings.metrics:
|
|
149
|
-
# Add Prometheus Instrumentator for /metrics
|
|
150
|
-
instrumentator = Instrumentator().instrument(app).expose(app)
|
|
151
|
-
instrumentator.add(payload_logs_by_payload(PAYLOAD_LIST))
|
|
152
|
-
instrumentator.add(payload_logs_total(PAYLOAD_LIST))
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
def run_api() -> None:
|
|
156
|
-
"""Start the FASTAPI Webserver."""
|
|
157
|
-
|
|
158
|
-
uvicorn.run(
|
|
159
|
-
"pyxecm.customizer.api:app",
|
|
160
|
-
host=api_settings.bind_address,
|
|
161
|
-
port=api_settings.bind_port,
|
|
162
|
-
workers=api_settings.workers,
|
|
163
|
-
)
|
pyxecm/customizer/log.py
DELETED
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
"""Common logging handler for VictoriaLogs and the LogCountFilter."""
|
|
2
|
-
|
|
3
|
-
import contextlib
|
|
4
|
-
import logging
|
|
5
|
-
import socket
|
|
6
|
-
from datetime import datetime, timezone
|
|
7
|
-
|
|
8
|
-
import requests
|
|
9
|
-
|
|
10
|
-
try:
|
|
11
|
-
import pandas as pd
|
|
12
|
-
|
|
13
|
-
pandas_installed = True
|
|
14
|
-
except ModuleNotFoundError:
|
|
15
|
-
pandas_installed = False
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
class VictoriaLogsHandler(logging.Handler):
|
|
19
|
-
"""Logging handler for VictoriaLogs.
|
|
20
|
-
|
|
21
|
-
Args:
|
|
22
|
-
logging (_type_): _description_
|
|
23
|
-
|
|
24
|
-
"""
|
|
25
|
-
|
|
26
|
-
def __init__(
|
|
27
|
-
self,
|
|
28
|
-
host: str,
|
|
29
|
-
port: int = 9428,
|
|
30
|
-
accountid: int = 0,
|
|
31
|
-
projectid: int = 0,
|
|
32
|
-
**kwargs: str | int,
|
|
33
|
-
) -> None:
|
|
34
|
-
"""Initialize the log handler.
|
|
35
|
-
|
|
36
|
-
Args:
|
|
37
|
-
host (_type_): _description_
|
|
38
|
-
port (int, optional): _description_. Defaults to 9428.
|
|
39
|
-
accountid (int, optional): _description_. Defaults to 0.
|
|
40
|
-
projectid (int, optional): _description_. Defaults to 0.
|
|
41
|
-
kwargs (dict[str, Any]): ability to add additional arguments into the request body
|
|
42
|
-
|
|
43
|
-
"""
|
|
44
|
-
logging.Handler.__init__(self)
|
|
45
|
-
self.url = f"http://{host}:{port}/insert/jsonline?_stream_fields=host,app&_msg_field=msg&_time_field=time"
|
|
46
|
-
self.accountid = accountid
|
|
47
|
-
self.projectid = projectid
|
|
48
|
-
self.kwargs = kwargs
|
|
49
|
-
|
|
50
|
-
def emit(self, record: logging.LogRecord) -> None:
|
|
51
|
-
"""Send request to VictoriaLogs.
|
|
52
|
-
|
|
53
|
-
Args:
|
|
54
|
-
record (_type_): _description_
|
|
55
|
-
|
|
56
|
-
"""
|
|
57
|
-
payload = {
|
|
58
|
-
"host": socket.gethostname(),
|
|
59
|
-
"processid": record.process,
|
|
60
|
-
"logger": record.name,
|
|
61
|
-
"level": record.levelname,
|
|
62
|
-
"thread": record.threadName,
|
|
63
|
-
"threadid": record.thread,
|
|
64
|
-
"time": datetime.now(timezone.utc).isoformat(),
|
|
65
|
-
"msg": f"[{record.levelname}] {record.getMessage()}",
|
|
66
|
-
"module": record.module,
|
|
67
|
-
}
|
|
68
|
-
payload.update(self.kwargs)
|
|
69
|
-
|
|
70
|
-
headers = {
|
|
71
|
-
"Content-type": "application/json",
|
|
72
|
-
"AccountID": str(self.accountid),
|
|
73
|
-
"ProjectID": str(self.projectid),
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
with contextlib.suppress(Exception):
|
|
77
|
-
requests.post(self.url, headers=headers, json=payload, timeout=1)
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
class LogCountFilter(logging.Filter):
|
|
81
|
-
"""LogFilter to be assinged to thread_logger to count the number os messages by level."""
|
|
82
|
-
|
|
83
|
-
def __init__(self, payload_items: pd.DataFrame, index: int) -> None:
|
|
84
|
-
"""LogCountFilter initializer.
|
|
85
|
-
|
|
86
|
-
Args:
|
|
87
|
-
payload_items (pd.DataFrame): _description_
|
|
88
|
-
index (int): _description_
|
|
89
|
-
|
|
90
|
-
"""
|
|
91
|
-
super().__init__()
|
|
92
|
-
self.index = index
|
|
93
|
-
self.payload_items = payload_items
|
|
94
|
-
|
|
95
|
-
def filter(self, record: logging.LogRecord) -> bool:
|
|
96
|
-
"""Filter method.
|
|
97
|
-
|
|
98
|
-
Args:
|
|
99
|
-
record (_type_): _description_
|
|
100
|
-
|
|
101
|
-
Returns:
|
|
102
|
-
bool: _description_
|
|
103
|
-
|
|
104
|
-
"""
|
|
105
|
-
level_name = (record.levelname).lower()
|
|
106
|
-
self.payload_items.loc[self.index, f"log_{level_name}"] += 1
|
|
107
|
-
return True
|