fractal-server 2.11.0a6__py3-none-any.whl → 2.11.0a7__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.11.0a6"
1
+ __VERSION__ = "2.11.0a7"
@@ -7,12 +7,15 @@ from sqlmodel import select
7
7
  from fractal_server.app.db import get_sync_db
8
8
  from fractal_server.app.models import DatasetV2
9
9
  from fractal_server.app.models import JobV2
10
+ from fractal_server.app.models import ProjectV2
10
11
  from fractal_server.app.models import WorkflowTaskV2
12
+ from fractal_server.app.models import WorkflowV2
11
13
  from fractal_server.app.schemas.v2 import DatasetReadV2
12
14
  from fractal_server.app.schemas.v2 import JobReadV2
13
15
  from fractal_server.app.schemas.v2 import ProjectReadV2
14
16
  from fractal_server.app.schemas.v2 import TaskReadV2
15
17
  from fractal_server.app.schemas.v2 import WorkflowTaskReadV2
18
+ from fractal_server.images.models import AttributeFiltersType
16
19
 
17
20
  logger = logging.getLogger("fix_db")
18
21
  logger.setLevel(logging.INFO)
@@ -21,23 +24,25 @@ logger.setLevel(logging.INFO)
21
24
  def dict_values_to_list(
22
25
  input_dict: dict[str, Union[int, float, bool, str, None]],
23
26
  identifier: str,
24
- ) -> dict[str, list[Union[int, float, bool, str]]]:
27
+ ) -> tuple[AttributeFiltersType, bool]:
28
+ was_there_a_warning = False
25
29
  for k, v in input_dict.items():
26
30
  if not isinstance(v, (int, float, bool, str, type(None))):
27
31
  error_msg = (
28
32
  f"Attribute '{k}' from '{identifier}' "
29
- f"has invalid type '{type(v)}'."
33
+ "has invalid type '{type(v)}'."
30
34
  )
31
35
  logger.error(error_msg)
32
36
  raise RuntimeError(error_msg)
33
37
  elif v is None:
34
38
  logger.warning(
35
- f"Attribute '{k}' from '{identifier}' is None and it "
36
- "will be removed."
39
+ f"Attribute '{k}' from '{identifier}' is "
40
+ "None and it will be removed."
37
41
  )
42
+ was_there_a_warning = True
38
43
  else:
39
44
  input_dict[k] = [v]
40
- return input_dict
45
+ return input_dict, was_there_a_warning
41
46
 
42
47
 
43
48
  def fix_db():
@@ -45,15 +50,24 @@ def fix_db():
45
50
 
46
51
  with next(get_sync_db()) as db:
47
52
  # DatasetV2.filters
48
- # DatasetV2.history[].workflowtask.input_filters
49
53
  stm = select(DatasetV2).order_by(DatasetV2.id)
50
54
  datasets = db.execute(stm).scalars().all()
51
55
  for ds in datasets:
52
56
  logger.info(f"DatasetV2[{ds.id}] START")
53
- ds.attribute_filters = dict_values_to_list(
57
+ ds.attribute_filters, warning = dict_values_to_list(
54
58
  ds.filters["attributes"],
55
59
  f"Dataset[{ds.id}].filters.attributes",
56
60
  )
61
+ if warning:
62
+ proj = db.get(ProjectV2, ds.project_id)
63
+ logger.warning(
64
+ "Additional information: "
65
+ f"{proj.id=}, "
66
+ f"{proj.name=}, "
67
+ f"{proj.user_list[0].email=}, "
68
+ f"{ds.id=}, "
69
+ f"{ds.name=}"
70
+ )
57
71
  ds.type_filters = ds.filters["types"]
58
72
  ds.filters = None
59
73
  for i, h in enumerate(ds.history):
@@ -81,6 +95,17 @@ def fix_db():
81
95
  "Removing input_filters['attributes']. "
82
96
  f"(previous value: {wft.input_filters['attributes']})"
83
97
  )
98
+ wf = db.get(WorkflowV2, wft.workflow_id)
99
+ proj = db.get(ProjectV2, wf.project_id)
100
+ logger.warning(
101
+ "Additional information: "
102
+ f"{proj.id=}, "
103
+ f"{proj.name=}, "
104
+ f"{proj.user_list[0].email=}, "
105
+ f"{wf.id=}, "
106
+ f"{wf.name=}, "
107
+ f"{wft.task.name=}"
108
+ )
84
109
  wft.input_filters = None
85
110
  flag_modified(wft, "input_filters")
86
111
  WorkflowTaskReadV2(
@@ -100,10 +125,28 @@ def fix_db():
100
125
  job.dataset_dump["type_filters"] = job.dataset_dump["filters"][
101
126
  "types"
102
127
  ]
103
- job.dataset_dump["attribute_filters"] = dict_values_to_list(
128
+ (
129
+ job.dataset_dump["attribute_filters"],
130
+ warning,
131
+ ) = dict_values_to_list(
104
132
  job.dataset_dump["filters"]["attributes"],
105
133
  f"JobV2[{job.id}].dataset_dump.filters.attributes",
106
134
  )
135
+ if warning and job.project_id is not None:
136
+ proj = db.get(ProjectV2, job.project_id)
137
+ logger.warning(
138
+ "Additional information: "
139
+ f"{proj.id=}, "
140
+ f"{proj.name=}, "
141
+ f"{proj.user_list[0].email=}, "
142
+ f"{job.id=}, "
143
+ f"{job.start_timestamp=}, "
144
+ f"{job.end_timestamp=}, "
145
+ f"{job.dataset_id=}, "
146
+ f"{job.workflow_id=}."
147
+ )
148
+ # FIXME
149
+ pass
107
150
  job.dataset_dump.pop("filters")
108
151
  flag_modified(job, "dataset_dump")
109
152
  JobReadV2(**job.model_dump())
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: fractal-server
3
- Version: 2.11.0a6
3
+ Version: 2.11.0a7
4
4
  Summary: Backend component of the Fractal analytics platform
5
5
  Home-page: https://github.com/fractal-analytics-platform/fractal-server
6
6
  License: BSD-3-Clause
@@ -1,4 +1,4 @@
1
- fractal_server/__init__.py,sha256=aC0yx2HX8xIU9XVrkikksq9g-IXOskfofOk8lZZtKNc,25
1
+ fractal_server/__init__.py,sha256=mM9PejPd0ZnCDoi6-w05W_qaatAjbN_mn-vxn7wialA,25
2
2
  fractal_server/__main__.py,sha256=D2YTmSowmXNyvqOjW_HeItCZT2UliWlySl_owicaZg0,8026
3
3
  fractal_server/alembic.ini,sha256=MWwi7GzjzawI9cCAK1LW7NxIBQDUqD12-ptJoq5JpP0,3153
4
4
  fractal_server/app/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -165,7 +165,7 @@ fractal_server/app/security/__init__.py,sha256=qn6idYgl-p5HWea0gTVnz4JnkoxGEkmQj
165
165
  fractal_server/app/security/signup_email.py,sha256=DrL51UdTSrgjleynMD5CRZwTSOpPrZ96fasRV0fvxDE,1165
166
166
  fractal_server/app/user_settings.py,sha256=OP1yiYKtPadxwM51_Q0hdPk3z90TCN4z1BLpQsXyWiU,1316
167
167
  fractal_server/config.py,sha256=9rAzw7OO6ZeHEz-I8NJHuGoHf4xCHxfFLyRNZQD9ytY,27019
168
- fractal_server/data_migrations/2_11_0.py,sha256=hkOZsvTWi30TqpSsAWuPyL4XxEJlqLwAv02PkVIk4Rw,4337
168
+ fractal_server/data_migrations/2_11_0.py,sha256=Zlmo4e39q5IiSM8p38T5NCnUEAsUxe08lt6TeUx-fRE,5997
169
169
  fractal_server/data_migrations/README.md,sha256=_3AEFvDg9YkybDqCLlFPdDmGJvr6Tw7HRI14aZ3LOIw,398
170
170
  fractal_server/data_migrations/tools.py,sha256=LeMeASwYGtEqd-3wOLle6WARdTGAimoyMmRbbJl-hAM,572
171
171
  fractal_server/gunicorn_fractal.py,sha256=u6U01TLGlXgq1v8QmEpLih3QnsInZD7CqphgJ_GrGzc,1230
@@ -241,8 +241,8 @@ fractal_server/tasks/v2/utils_templates.py,sha256=07TZpJ0Mh_A4lXVXrrH2o1VLFFGwxe
241
241
  fractal_server/urls.py,sha256=QjIKAC1a46bCdiPMu3AlpgFbcv6a4l3ABcd5xz190Og,471
242
242
  fractal_server/utils.py,sha256=PMwrxWFxRTQRl1b9h-NRIbFGPKqpH_hXnkAT3NfZdpY,3571
243
243
  fractal_server/zip_tools.py,sha256=GjDgo_sf6V_DDg6wWeBlZu5zypIxycn_l257p_YVKGc,4876
244
- fractal_server-2.11.0a6.dist-info/LICENSE,sha256=QKAharUuhxL58kSoLizKJeZE3mTCBnX6ucmz8W0lxlk,1576
245
- fractal_server-2.11.0a6.dist-info/METADATA,sha256=jtJXV-kHK3rf-ha0pEYyhIzwCRKox9fHBQ38M1xti38,4564
246
- fractal_server-2.11.0a6.dist-info/WHEEL,sha256=RaoafKOydTQ7I_I3JTrPCg6kUmTgtm4BornzOqyEfJ8,88
247
- fractal_server-2.11.0a6.dist-info/entry_points.txt,sha256=8tV2kynvFkjnhbtDnxAqImL6HMVKsopgGfew0DOp5UY,58
248
- fractal_server-2.11.0a6.dist-info/RECORD,,
244
+ fractal_server-2.11.0a7.dist-info/LICENSE,sha256=QKAharUuhxL58kSoLizKJeZE3mTCBnX6ucmz8W0lxlk,1576
245
+ fractal_server-2.11.0a7.dist-info/METADATA,sha256=3j0iczgnV5Ok6R3O8Zq56z41Hto-jwVnx8ujk2ikeUQ,4564
246
+ fractal_server-2.11.0a7.dist-info/WHEEL,sha256=RaoafKOydTQ7I_I3JTrPCg6kUmTgtm4BornzOqyEfJ8,88
247
+ fractal_server-2.11.0a7.dist-info/entry_points.txt,sha256=8tV2kynvFkjnhbtDnxAqImL6HMVKsopgGfew0DOp5UY,58
248
+ fractal_server-2.11.0a7.dist-info/RECORD,,