diracx-db 0.0.1a21__py3-none-any.whl → 0.0.1a23__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.
- diracx/db/sql/job_logging/db.py +20 -16
- diracx/db/sql/utils/job.py +1 -0
- {diracx_db-0.0.1a21.dist-info → diracx_db-0.0.1a23.dist-info}/METADATA +1 -1
- {diracx_db-0.0.1a21.dist-info → diracx_db-0.0.1a23.dist-info}/RECORD +7 -7
- {diracx_db-0.0.1a21.dist-info → diracx_db-0.0.1a23.dist-info}/WHEEL +0 -0
- {diracx_db-0.0.1a21.dist-info → diracx_db-0.0.1a23.dist-info}/entry_points.txt +0 -0
- {diracx_db-0.0.1a21.dist-info → diracx_db-0.0.1a23.dist-info}/top_level.txt +0 -0
diracx/db/sql/job_logging/db.py
CHANGED
@@ -105,10 +105,9 @@ class JobLoggingDB(BaseSQLDB):
|
|
105
105
|
|
106
106
|
seqnum = {jid: seqnum for jid, seqnum in (await self.conn.execute(seqnum_stmt))}
|
107
107
|
# IF a seqnum is not found, then assume it does not exist and the first sequence number is 1.
|
108
|
-
|
109
108
|
# https://docs.sqlalchemy.org/en/20/orm/queryguide/dml.html#orm-bulk-insert-statements
|
110
109
|
await self.conn.execute(
|
111
|
-
insert(
|
110
|
+
LoggingInfo.__table__.insert(),
|
112
111
|
[
|
113
112
|
{
|
114
113
|
"JobID": record.job_id,
|
@@ -118,38 +117,43 @@ class JobLoggingDB(BaseSQLDB):
|
|
118
117
|
"ApplicationStatus": record.application_status[:255],
|
119
118
|
"StatusTime": record.date,
|
120
119
|
"StatusTimeOrder": get_epoc(record.date),
|
121
|
-
"
|
120
|
+
"StatusSource": record.source[:32],
|
122
121
|
}
|
123
122
|
for record in records
|
124
123
|
],
|
125
124
|
)
|
126
125
|
|
127
|
-
async def get_records(self,
|
126
|
+
async def get_records(self, job_ids: list[int]) -> dict[int, JobStatusReturn]:
|
128
127
|
"""Returns a Status,MinorStatus,ApplicationStatus,StatusTime,Source tuple
|
129
128
|
for each record found for job specified by its jobID in historical order.
|
130
129
|
"""
|
130
|
+
# We could potentially use a group_by here, but we need to post-process the
|
131
|
+
# results later.
|
131
132
|
stmt = (
|
132
133
|
select(
|
134
|
+
LoggingInfo.JobID,
|
133
135
|
LoggingInfo.Status,
|
134
136
|
LoggingInfo.MinorStatus,
|
135
137
|
LoggingInfo.ApplicationStatus,
|
136
138
|
LoggingInfo.StatusTime,
|
137
139
|
LoggingInfo.Source,
|
138
140
|
)
|
139
|
-
.where(LoggingInfo.JobID
|
141
|
+
.where(LoggingInfo.JobID.in_(job_ids))
|
140
142
|
.order_by(LoggingInfo.StatusTimeOrder, LoggingInfo.StatusTime)
|
141
143
|
)
|
142
144
|
rows = await self.conn.execute(stmt)
|
143
145
|
|
144
|
-
values =
|
146
|
+
values = defaultdict(list)
|
145
147
|
for (
|
148
|
+
job_id,
|
146
149
|
status,
|
147
150
|
minor_status,
|
148
151
|
application_status,
|
149
152
|
status_time,
|
150
153
|
status_source,
|
151
154
|
) in rows:
|
152
|
-
|
155
|
+
|
156
|
+
values[job_id].append(
|
153
157
|
[
|
154
158
|
status,
|
155
159
|
minor_status,
|
@@ -161,16 +165,16 @@ class JobLoggingDB(BaseSQLDB):
|
|
161
165
|
|
162
166
|
# If no value has been set for the application status in the first place,
|
163
167
|
# We put this status to unknown
|
164
|
-
res =
|
165
|
-
|
166
|
-
if
|
167
|
-
|
168
|
+
res: dict = defaultdict(list)
|
169
|
+
for job_id, history in values.items():
|
170
|
+
if history[0][2] == "idem":
|
171
|
+
history[0][2] = "Unknown"
|
168
172
|
|
169
173
|
# We replace "idem" values by the value previously stated
|
170
|
-
for i in range(1, len(
|
174
|
+
for i in range(1, len(history)):
|
171
175
|
for j in range(3):
|
172
|
-
if
|
173
|
-
|
176
|
+
if history[i][j] == "idem":
|
177
|
+
history[i][j] = history[i - 1][j]
|
174
178
|
|
175
179
|
# And we replace arrays with tuples
|
176
180
|
for (
|
@@ -179,8 +183,8 @@ class JobLoggingDB(BaseSQLDB):
|
|
179
183
|
application_status,
|
180
184
|
status_time,
|
181
185
|
status_source,
|
182
|
-
) in
|
183
|
-
res.append(
|
186
|
+
) in history:
|
187
|
+
res[job_id].append(
|
184
188
|
JobStatusReturn(
|
185
189
|
Status=status,
|
186
190
|
MinorStatus=minor_status,
|
diracx/db/sql/utils/job.py
CHANGED
@@ -16,7 +16,7 @@ diracx/db/sql/job/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU
|
|
16
16
|
diracx/db/sql/job/db.py,sha256=54TjRzWBgD2xhM3ljdel399xq8ro4Z0k3c7zWlXXCUI,11616
|
17
17
|
diracx/db/sql/job/schema.py,sha256=w9Ht9LyVK-fB5T9-hYGsqifzneeG2YP123j1-Mx8Xio,4283
|
18
18
|
diracx/db/sql/job_logging/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
19
|
-
diracx/db/sql/job_logging/db.py,sha256=
|
19
|
+
diracx/db/sql/job_logging/db.py,sha256=RrvIptxFIVrRETxFgqXvA6OzWlA6i6M21LlSzIQcILc,7787
|
20
20
|
diracx/db/sql/job_logging/schema.py,sha256=dD2arl-6bffeK8INT6tZ1HWEpJuYTx2iNiVzswVXXF8,812
|
21
21
|
diracx/db/sql/pilot_agents/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
22
22
|
diracx/db/sql/pilot_agents/db.py,sha256=7-cuCbh_KhM0jlybsHMWV-W66bHsPHIVBpbuqwjncj0,1232
|
@@ -28,9 +28,9 @@ diracx/db/sql/task_queue/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
|
|
28
28
|
diracx/db/sql/task_queue/db.py,sha256=e6yauZO0nWaUVqjqQycH8iPO4wXLXaC82eaIq1K_KI8,9102
|
29
29
|
diracx/db/sql/task_queue/schema.py,sha256=fvzQyCw_xWAOWTLW6Qrp1m-WzEKb0tlYmafoLTbCy1I,3222
|
30
30
|
diracx/db/sql/utils/__init__.py,sha256=fANPhXofb3ghvnOeLXmcK33YiViJFG8gI2C-2AMArEs,15647
|
31
|
-
diracx/db/sql/utils/job.py,sha256=
|
32
|
-
diracx_db-0.0.
|
33
|
-
diracx_db-0.0.
|
34
|
-
diracx_db-0.0.
|
35
|
-
diracx_db-0.0.
|
36
|
-
diracx_db-0.0.
|
31
|
+
diracx/db/sql/utils/job.py,sha256=B5l9yVdxf67sNxo3iNmrBrIkY184tx8PjFHPij7tpns,19418
|
32
|
+
diracx_db-0.0.1a23.dist-info/METADATA,sha256=l60dT_mkn_EtQVz4HmyxW4z6CXPiJR3M3fpTA_yO9-o,688
|
33
|
+
diracx_db-0.0.1a23.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
34
|
+
diracx_db-0.0.1a23.dist-info/entry_points.txt,sha256=YLI4f6640bri8Ud6Jt9WNq79pSTVQAkfUasb9f75fR8,315
|
35
|
+
diracx_db-0.0.1a23.dist-info/top_level.txt,sha256=vJx10tdRlBX3rF2Psgk5jlwVGZNcL3m_7iQWwgPXt-U,7
|
36
|
+
diracx_db-0.0.1a23.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|