fractal-server 2.14.0a8__py3-none-any.whl → 2.14.0a9__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.0a8"
1
+ __VERSION__ = "2.14.0a9"
@@ -14,16 +14,12 @@ from ....db import get_async_db
14
14
  from ....models.v2 import JobV2
15
15
  from ....models.v2 import ProjectV2
16
16
  from ....models.v2 import WorkflowV2
17
- from ....runner.set_start_and_last_task_index import (
18
- set_start_and_last_task_index,
19
- )
20
17
  from ....schemas.v2 import WorkflowCreateV2
21
18
  from ....schemas.v2 import WorkflowExportV2
22
19
  from ....schemas.v2 import WorkflowReadV2
23
20
  from ....schemas.v2 import WorkflowReadV2WithWarnings
24
21
  from ....schemas.v2 import WorkflowUpdateV2
25
22
  from ._aux_functions import _check_workflow_exists
26
- from ._aux_functions import _get_dataset_check_owner
27
23
  from ._aux_functions import _get_project_check_owner
28
24
  from ._aux_functions import _get_submitted_jobs_statement
29
25
  from ._aux_functions import _get_workflow_check_owner
@@ -293,27 +289,21 @@ async def get_user_workflows(
293
289
  return workflow_list
294
290
 
295
291
 
296
- class TypeFiltersFlow(BaseModel):
297
- dataset_filters: list[dict[str, bool]]
298
- input_filters: list[dict[str, bool]]
299
- output_filters: list[dict[str, bool]]
292
+ class WorkflowTaskTypeFiltersInfo(BaseModel):
293
+ current_type_filters: dict[str, bool]
294
+ input_type_filters: dict[str, bool]
295
+ output_type_filters: dict[str, bool]
300
296
 
301
297
 
302
- @router.get(
303
- "/project/{project_id}/workflow/{workflow_id}/type-filters-flow/",
304
- response_model=TypeFiltersFlow,
305
- )
298
+ @router.get("/project/{project_id}/workflow/{workflow_id}/type-filters-flow/")
306
299
  async def get_workflow_type_filters(
307
300
  project_id: int,
308
301
  workflow_id: int,
309
- dataset_id: Optional[int] = None,
310
- first_task_index: Optional[int] = None,
311
- last_task_index: Optional[int] = None,
312
302
  user: UserOAuth = Depends(current_active_user),
313
303
  db: AsyncSession = Depends(get_async_db),
314
- ) -> Optional[WorkflowReadV2WithWarnings]:
304
+ ) -> dict[str, WorkflowTaskTypeFiltersInfo]:
315
305
  """
316
- Get info on an existing workflow
306
+ Get info on type/type-filters flow for a workflow.
317
307
  """
318
308
 
319
309
  workflow = await _get_workflow_check_owner(
@@ -323,59 +313,32 @@ async def get_workflow_type_filters(
323
313
  db=db,
324
314
  )
325
315
 
326
- if len(workflow.task_list) == 0:
316
+ num_tasks = len(workflow.task_list)
317
+ if num_tasks == 0:
327
318
  raise HTTPException(
328
319
  status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,
329
320
  detail="Workflow has no tasks.",
330
321
  )
331
322
 
332
- if dataset_id is None:
333
- dataset_type_filters = {}
334
- else:
335
- res = await _get_dataset_check_owner(
336
- project_id=project_id,
337
- dataset_id=dataset_id,
338
- user_id=user.id,
339
- db=db,
340
- )
341
- dataset = res["dataset"]
342
- dataset_type_filters = dataset.type_filters
343
-
344
- num_tasks = len(workflow.task_list)
345
- try:
346
- first_task_index, last_task_index = set_start_and_last_task_index(
347
- num_tasks,
348
- first_task_index=first_task_index,
349
- last_task_index=last_task_index,
350
- )
351
- except ValueError as e:
352
- raise HTTPException(
353
- status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,
354
- detail=f"Invalid first/last task index.\nOriginal error: {str(e)}",
355
- )
323
+ current_type_filters = {}
356
324
 
357
- list_dataset_filters = [copy(dataset_type_filters)]
358
- list_filters_in = []
359
- list_filters_out = []
360
- for wftask in workflow.task_list[first_task_index : last_task_index + 1]:
325
+ response = {}
326
+ for wftask in workflow.task_list:
361
327
 
362
- input_type_filters = copy(dataset_type_filters)
363
- patch = merge_type_filters(
328
+ # Compute input_type_filters, based on wftask and task manifest
329
+ input_type_filters = merge_type_filters(
364
330
  wftask_type_filters=wftask.type_filters,
365
331
  task_input_types=wftask.task.input_types,
366
332
  )
367
- input_type_filters.update(patch)
368
- list_filters_in.append(copy(input_type_filters))
369
333
 
370
- output_type_filters = wftask.task.output_types
371
- list_filters_out.append(output_type_filters)
334
+ # Append current item to response list
335
+ response[str(wftask.id)] = dict(
336
+ current_type_filters=copy(current_type_filters),
337
+ input_type_filters=copy(input_type_filters),
338
+ output_type_filters=copy(wftask.task.output_types),
339
+ )
372
340
 
373
- dataset_type_filters.update(wftask.task.output_types)
374
- list_dataset_filters.append(copy(dataset_type_filters))
341
+ # Update `current_type_filters`
342
+ current_type_filters.update(wftask.task.output_types)
375
343
 
376
- response_body = dict(
377
- dataset_filters=list_dataset_filters,
378
- input_filters=list_filters_in,
379
- output_filters=list_filters_out,
380
- )
381
- return response_body
344
+ return response
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: fractal-server
3
- Version: 2.14.0a8
3
+ Version: 2.14.0a9
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=kGAQu3H-ucHD5NhKhR9WUJUdDh_6vyFTxQN6G9BnBpY,25
1
+ fractal_server/__init__.py,sha256=E9dF_7reewiCJauBwZifrX9piwxy4gBB_Eqz9YpzK1M,25
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
@@ -47,7 +47,7 @@ fractal_server/app/routes/api/v2/task_collection.py,sha256=IDNF6sjDuU37HIQ0TuQA-
47
47
  fractal_server/app/routes/api/v2/task_collection_custom.py,sha256=cctW61-C2QYF2KXluS15lLhZJS_kt30Ca6UGLFO32z0,6207
48
48
  fractal_server/app/routes/api/v2/task_group.py,sha256=j3zDvVZizB7NWEgVgZU42JCXETkaVkk2ImJPr0jS7BQ,8164
49
49
  fractal_server/app/routes/api/v2/task_group_lifecycle.py,sha256=3o9bCC8ubMwffQPPaxQZy-CjH9IB2RkIReIecI6L2_w,9300
50
- fractal_server/app/routes/api/v2/workflow.py,sha256=U3iZX5IiFAJ20-R8IjlYToOdm9gXsmtr1lW7ASEH9P8,11689
50
+ fractal_server/app/routes/api/v2/workflow.py,sha256=2ZqpKTbr4hUuoXDm7WEIX7j_BLVC78ssnHKOqa4tiEg,10459
51
51
  fractal_server/app/routes/api/v2/workflow_import.py,sha256=INmnhlMEBJp-vHPR0f940DANPmIidts3OfcooeM_aNA,11205
52
52
  fractal_server/app/routes/api/v2/workflowtask.py,sha256=7_syX2EO7ibF6Xkm7HBPhsUYq6aYnKNeC5iSaafQhG4,11342
53
53
  fractal_server/app/routes/auth/__init__.py,sha256=fao6CS0WiAjHDTvBzgBVV_bSXFpEAeDBF6Z6q7rRkPc,1658
@@ -205,8 +205,8 @@ fractal_server/tasks/v2/utils_templates.py,sha256=Kc_nSzdlV6KIsO0CQSPs1w70zLyENP
205
205
  fractal_server/urls.py,sha256=QjIKAC1a46bCdiPMu3AlpgFbcv6a4l3ABcd5xz190Og,471
206
206
  fractal_server/utils.py,sha256=PMwrxWFxRTQRl1b9h-NRIbFGPKqpH_hXnkAT3NfZdpY,3571
207
207
  fractal_server/zip_tools.py,sha256=GjDgo_sf6V_DDg6wWeBlZu5zypIxycn_l257p_YVKGc,4876
208
- fractal_server-2.14.0a8.dist-info/LICENSE,sha256=QKAharUuhxL58kSoLizKJeZE3mTCBnX6ucmz8W0lxlk,1576
209
- fractal_server-2.14.0a8.dist-info/METADATA,sha256=9Y62LfjS5cZ88MZggxLwL2usMbt3Ny9GPiX8CBhFgpQ,4562
210
- fractal_server-2.14.0a8.dist-info/WHEEL,sha256=7dDg4QLnNKTvwIDR9Ac8jJaAmBC_owJrckbC0jjThyA,88
211
- fractal_server-2.14.0a8.dist-info/entry_points.txt,sha256=8tV2kynvFkjnhbtDnxAqImL6HMVKsopgGfew0DOp5UY,58
212
- fractal_server-2.14.0a8.dist-info/RECORD,,
208
+ fractal_server-2.14.0a9.dist-info/LICENSE,sha256=QKAharUuhxL58kSoLizKJeZE3mTCBnX6ucmz8W0lxlk,1576
209
+ fractal_server-2.14.0a9.dist-info/METADATA,sha256=ZeOIxRJewSWlF3Y1yfC767EtZrhOzPGW97Hjpo_0ewI,4562
210
+ fractal_server-2.14.0a9.dist-info/WHEEL,sha256=7dDg4QLnNKTvwIDR9Ac8jJaAmBC_owJrckbC0jjThyA,88
211
+ fractal_server-2.14.0a9.dist-info/entry_points.txt,sha256=8tV2kynvFkjnhbtDnxAqImL6HMVKsopgGfew0DOp5UY,58
212
+ fractal_server-2.14.0a9.dist-info/RECORD,,