fractal-server 2.14.14__py3-none-any.whl → 2.14.15__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.14.14"
1
+ __VERSION__ = "2.14.15"
@@ -4,7 +4,6 @@ from fastapi import status
4
4
  from fastapi.responses import JSONResponse
5
5
  from pydantic import BaseModel
6
6
  from pydantic import Field
7
- from sqlmodel import select
8
7
 
9
8
  from ._aux_functions import _get_dataset_check_owner
10
9
  from ._aux_functions import _get_workflow_task_check_owner
@@ -12,11 +11,11 @@ from .images import ImageQuery
12
11
  from fractal_server.app.db import AsyncSession
13
12
  from fractal_server.app.db import get_async_db
14
13
  from fractal_server.app.models import UserOAuth
15
- from fractal_server.app.models.v2 import HistoryImageCache
16
- from fractal_server.app.models.v2 import HistoryUnit
17
14
  from fractal_server.app.routes.auth import current_active_user
18
15
  from fractal_server.app.schemas.v2 import HistoryUnitStatus
19
16
  from fractal_server.app.schemas.v2 import TaskType
17
+ from fractal_server.images.status_tools import enrich_images_async
18
+ from fractal_server.images.status_tools import IMAGE_STATUS_KEY
20
19
  from fractal_server.images.tools import aggregate_types
21
20
  from fractal_server.images.tools import filter_image_list
22
21
  from fractal_server.types import AttributeFilters
@@ -31,6 +30,7 @@ router = APIRouter()
31
30
  async def verify_unique_types(
32
31
  project_id: int,
33
32
  dataset_id: int,
33
+ workflowtask_id: int,
34
34
  query: ImageQuery | None = None,
35
35
  user: UserOAuth = Depends(current_active_user),
36
36
  db: AsyncSession = Depends(get_async_db),
@@ -45,8 +45,17 @@ async def verify_unique_types(
45
45
  if query is None:
46
46
  filtered_images = dataset.images
47
47
  else:
48
+ if IMAGE_STATUS_KEY in query.attribute_filters.keys():
49
+ images = await enrich_images_async(
50
+ dataset_id=dataset_id,
51
+ workflowtask_id=workflowtask_id,
52
+ images=dataset.images,
53
+ db=db,
54
+ )
55
+ else:
56
+ images = dataset.images
48
57
  filtered_images = filter_image_list(
49
- images=dataset.images,
58
+ images=images,
50
59
  attribute_filters=query.attribute_filters,
51
60
  type_filters=query.type_filters,
52
61
  )
@@ -78,7 +87,7 @@ class NonProcessedImagesPayload(BaseModel):
78
87
  "/project/{project_id}/dataset/{dataset_id}/images/non-processed/",
79
88
  status_code=status.HTTP_200_OK,
80
89
  )
81
- async def check_workflowtask(
90
+ async def check_non_processed_images(
82
91
  project_id: int,
83
92
  dataset_id: int,
84
93
  workflow_id: int,
@@ -125,19 +134,16 @@ async def check_workflowtask(
125
134
  attribute_filters=filters.attribute_filters,
126
135
  )
127
136
 
128
- filtered_zarr_urls = [image["zarr_url"] for image in filtered_images]
129
-
130
- res = await db.execute(
131
- select(HistoryImageCache.zarr_url)
132
- .join(HistoryUnit)
133
- .where(HistoryImageCache.zarr_url.in_(filtered_zarr_urls))
134
- .where(HistoryImageCache.dataset_id == dataset_id)
135
- .where(HistoryImageCache.workflowtask_id == previous_wft.id)
136
- .where(HistoryImageCache.latest_history_unit_id == HistoryUnit.id)
137
- .where(HistoryUnit.status == HistoryUnitStatus.DONE)
137
+ filtered_images_with_status = await enrich_images_async(
138
+ dataset_id=dataset_id,
139
+ workflowtask_id=previous_wft.id,
140
+ images=filtered_images,
141
+ db=db,
138
142
  )
139
- done_zarr_urls = res.scalars().all()
140
-
141
- missing_zarr_urls = list(set(filtered_zarr_urls) - set(done_zarr_urls))
143
+ missing_zarr_urls = [
144
+ img["zarr_url"]
145
+ for img in filtered_images_with_status
146
+ if img["attributes"][IMAGE_STATUS_KEY] != HistoryUnitStatus.DONE
147
+ ]
142
148
 
143
149
  return JSONResponse(status_code=200, content=missing_zarr_urls)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: fractal-server
3
- Version: 2.14.14
3
+ Version: 2.14.15
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=vMwYn-JjDRvK-MC0CiCG-6inE2aJMQ7D6z9D_4s1WBI,24
1
+ fractal_server/__init__.py,sha256=1lO5LXhx8fwsKnWQVdnMtEvVmWkDE9cZ0L2RpkoG0O8,24
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
@@ -40,7 +40,7 @@ fractal_server/app/routes/api/v2/dataset.py,sha256=6u4MFqJ3YZ0Zq6Xx8CRMrTPKW55Za
40
40
  fractal_server/app/routes/api/v2/history.py,sha256=BEmf_ENF5HNMy8yXrxRdo4280rWuRUa1Jw4u8R9-LQQ,15477
41
41
  fractal_server/app/routes/api/v2/images.py,sha256=TS1ltUhP0_SaViupdHrSh3MLDi5OVk-lOhE1VCVyZj0,7869
42
42
  fractal_server/app/routes/api/v2/job.py,sha256=8xRTwh_OCHmK9IfI_zUASa2ozewR0qu0zVBl_a4IvHw,6467
43
- fractal_server/app/routes/api/v2/pre_submission_checks.py,sha256=bMcsZkXovK12EjtWarj_adEGIEuPOCIAug7myBcMlfs,4833
43
+ fractal_server/app/routes/api/v2/pre_submission_checks.py,sha256=122MlfYwBBIw39bo9b3xuhvzBG20olPvjCzudAxX8H4,4909
44
44
  fractal_server/app/routes/api/v2/project.py,sha256=ldMEyjtwGpX2teu85sCNWaubDFlw-En8U1SA7G1VaIw,4567
45
45
  fractal_server/app/routes/api/v2/status_legacy.py,sha256=ZckHeBy8y21cyQ_OLY-VmkapzMhd3g9ae-qg-r4-uVo,6317
46
46
  fractal_server/app/routes/api/v2/submit.py,sha256=_BDkWtFdo8-p7kZ0Oxaidei04MfuBeaEsWtwJaKZQ_Y,8781
@@ -216,8 +216,8 @@ fractal_server/types/validators/_workflow_task_arguments_validators.py,sha256=HL
216
216
  fractal_server/urls.py,sha256=QjIKAC1a46bCdiPMu3AlpgFbcv6a4l3ABcd5xz190Og,471
217
217
  fractal_server/utils.py,sha256=Vn35lApt1T1J8nc09sAVqd10Cy0sa3dLipcljI-hkuk,2185
218
218
  fractal_server/zip_tools.py,sha256=tqz_8f-vQ9OBRW-4OQfO6xxY-YInHTyHmZxU7U4PqZo,4885
219
- fractal_server-2.14.14.dist-info/LICENSE,sha256=QKAharUuhxL58kSoLizKJeZE3mTCBnX6ucmz8W0lxlk,1576
220
- fractal_server-2.14.14.dist-info/METADATA,sha256=JbVyOg4xYuckhqbiJv8_j881MND0jPMwXFLiM6zY1Os,4244
221
- fractal_server-2.14.14.dist-info/WHEEL,sha256=7dDg4QLnNKTvwIDR9Ac8jJaAmBC_owJrckbC0jjThyA,88
222
- fractal_server-2.14.14.dist-info/entry_points.txt,sha256=8tV2kynvFkjnhbtDnxAqImL6HMVKsopgGfew0DOp5UY,58
223
- fractal_server-2.14.14.dist-info/RECORD,,
219
+ fractal_server-2.14.15.dist-info/LICENSE,sha256=QKAharUuhxL58kSoLizKJeZE3mTCBnX6ucmz8W0lxlk,1576
220
+ fractal_server-2.14.15.dist-info/METADATA,sha256=Sz4teXD8HvAhlbNjhwBKfOiswHcP47lMAIMnHK6puVU,4244
221
+ fractal_server-2.14.15.dist-info/WHEEL,sha256=7dDg4QLnNKTvwIDR9Ac8jJaAmBC_owJrckbC0jjThyA,88
222
+ fractal_server-2.14.15.dist-info/entry_points.txt,sha256=8tV2kynvFkjnhbtDnxAqImL6HMVKsopgGfew0DOp5UY,58
223
+ fractal_server-2.14.15.dist-info/RECORD,,