fractal-server 2.15.4__py3-none-any.whl → 2.15.5__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.
@@ -1 +1 @@
1
- __VERSION__ = "2.15.4"
1
+ __VERSION__ = "2.15.5"
@@ -12,12 +12,15 @@ from sqlmodel import select
12
12
  from fractal_server.app.db import AsyncSession
13
13
  from fractal_server.app.db import get_async_db
14
14
  from fractal_server.app.models import UserOAuth
15
+ from fractal_server.app.models.v2 import HistoryRun
16
+ from fractal_server.app.models.v2 import HistoryUnit
15
17
  from fractal_server.app.models.v2 import JobV2
16
18
  from fractal_server.app.models.v2 import ProjectV2
17
19
  from fractal_server.app.routes.auth import current_active_superuser
18
20
  from fractal_server.app.routes.aux._job import _write_shutdown_file
19
21
  from fractal_server.app.routes.aux._runner import _check_shutdown_is_supported
20
22
  from fractal_server.app.runner.filenames import WORKFLOW_LOG_FILENAME
23
+ from fractal_server.app.schemas.v2 import HistoryUnitStatus
21
24
  from fractal_server.app.schemas.v2 import JobReadV2
22
25
  from fractal_server.app.schemas.v2 import JobStatusTypeV2
23
26
  from fractal_server.app.schemas.v2 import JobUpdateV2
@@ -148,6 +151,11 @@ async def update_job(
148
151
  status_code=status.HTTP_404_NOT_FOUND,
149
152
  detail=f"Job {job_id} not found",
150
153
  )
154
+ if job.status != JobStatusTypeV2.SUBMITTED:
155
+ raise HTTPException(
156
+ status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,
157
+ detail=f"Job {job_id} has status {job.status=} != 'submitted'.",
158
+ )
151
159
 
152
160
  if job_update.status != JobStatusTypeV2.FAILED:
153
161
  raise HTTPException(
@@ -164,6 +172,25 @@ async def update_job(
164
172
  f"{job.log or ''}\nThis job was manually marked as "
165
173
  f"'{JobStatusTypeV2.FAILED}' by an admin ({timestamp.isoformat()}).",
166
174
  )
175
+
176
+ res = await db.execute(
177
+ select(HistoryRun)
178
+ .where(HistoryRun.job_id == job_id)
179
+ .order_by(HistoryRun.timestamp_started.desc())
180
+ .limit(1)
181
+ )
182
+ latest_run = res.scalar_one_or_none()
183
+ if latest_run is not None:
184
+ setattr(latest_run, "status", HistoryUnitStatus.FAILED)
185
+ res = await db.execute(
186
+ select(HistoryUnit).where(
187
+ HistoryUnit.history_run_id == latest_run.id
188
+ )
189
+ )
190
+ history_units = res.scalars().all()
191
+ for history_unit in history_units:
192
+ setattr(history_unit, "status", HistoryUnitStatus.FAILED)
193
+
167
194
  await db.commit()
168
195
  await db.refresh(job)
169
196
  await db.close()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: fractal-server
3
- Version: 2.15.4
3
+ Version: 2.15.5
4
4
  Summary: Backend component of the Fractal analytics platform
5
5
  License: BSD-3-Clause
6
6
  Author: Tommaso Comparin
@@ -1,4 +1,4 @@
1
- fractal_server/__init__.py,sha256=oQyZUHcUuOnv7ZqsoVjwEhBSMPbobwbvTyb3GUD_ZT8,23
1
+ fractal_server/__init__.py,sha256=ov_g1jTxonHhycaNsA6l6SCH-LJTAVhUlTjOOgQa4Tc,23
2
2
  fractal_server/__main__.py,sha256=rkM8xjY1KeS3l63irB8yCrlVobR-73uDapC4wvrIlxI,6957
3
3
  fractal_server/alembic.ini,sha256=MWwi7GzjzawI9cCAK1LW7NxIBQDUqD12-ptJoq5JpP0,3153
4
4
  fractal_server/app/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -23,7 +23,7 @@ fractal_server/app/routes/admin/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm
23
23
  fractal_server/app/routes/admin/v2/__init__.py,sha256=_5lqb6-M8-fZqE1HRMep6pAFYRUKMxrvbZOKs-RXWkw,933
24
24
  fractal_server/app/routes/admin/v2/accounting.py,sha256=-eLzBirENvdhjhrCf6bs1pTriIui19DAr_k-zuJB7Y8,3593
25
25
  fractal_server/app/routes/admin/v2/impersonate.py,sha256=gc4lshfEPFR6W2asH7aKu6hqE6chzusdhAUVV9p51eU,1131
26
- fractal_server/app/routes/admin/v2/job.py,sha256=fl_1hWrriCA24OPlHZhxfnM1j0C4UL5hqjcG1ww8Fac,7584
26
+ fractal_server/app/routes/admin/v2/job.py,sha256=ysfrmsaLUwdo3_YbXOhh6j2zZqKrj5dF2s4gJf1ngtQ,8604
27
27
  fractal_server/app/routes/admin/v2/project.py,sha256=MA_LdoEuSuisSGRO43TapMuJ080y5iaUGSAUgKuuKOg,1188
28
28
  fractal_server/app/routes/admin/v2/task.py,sha256=8njjq_zcvNW-Ewxn7WfsRQbs_aV5h-7pgcRIAegzTnc,4308
29
29
  fractal_server/app/routes/admin/v2/task_group.py,sha256=JUCxKnwSNmOKyh6lpqfG5jT5BuRE_U2X6HqD5VVhWPg,7096
@@ -230,8 +230,8 @@ fractal_server/types/validators/_workflow_task_arguments_validators.py,sha256=HL
230
230
  fractal_server/urls.py,sha256=QjIKAC1a46bCdiPMu3AlpgFbcv6a4l3ABcd5xz190Og,471
231
231
  fractal_server/utils.py,sha256=Vn35lApt1T1J8nc09sAVqd10Cy0sa3dLipcljI-hkuk,2185
232
232
  fractal_server/zip_tools.py,sha256=H0w7wS5yE4ebj7hw1_77YQ959dl2c-L0WX6J_ro1TY4,4884
233
- fractal_server-2.15.4.dist-info/LICENSE,sha256=QKAharUuhxL58kSoLizKJeZE3mTCBnX6ucmz8W0lxlk,1576
234
- fractal_server-2.15.4.dist-info/METADATA,sha256=xtZoBMySmrfFIEf-RXzQHmqZUUvZr2Ud1cyR1rMLqoM,4283
235
- fractal_server-2.15.4.dist-info/WHEEL,sha256=7dDg4QLnNKTvwIDR9Ac8jJaAmBC_owJrckbC0jjThyA,88
236
- fractal_server-2.15.4.dist-info/entry_points.txt,sha256=8tV2kynvFkjnhbtDnxAqImL6HMVKsopgGfew0DOp5UY,58
237
- fractal_server-2.15.4.dist-info/RECORD,,
233
+ fractal_server-2.15.5.dist-info/LICENSE,sha256=QKAharUuhxL58kSoLizKJeZE3mTCBnX6ucmz8W0lxlk,1576
234
+ fractal_server-2.15.5.dist-info/METADATA,sha256=alHs8DIeP4bge-Vz4triLn_4wPoLN80jrrbbQpGqp4E,4283
235
+ fractal_server-2.15.5.dist-info/WHEEL,sha256=7dDg4QLnNKTvwIDR9Ac8jJaAmBC_owJrckbC0jjThyA,88
236
+ fractal_server-2.15.5.dist-info/entry_points.txt,sha256=8tV2kynvFkjnhbtDnxAqImL6HMVKsopgGfew0DOp5UY,58
237
+ fractal_server-2.15.5.dist-info/RECORD,,