_aux_functions
Auxiliary functions to get object from the database or perform simple checks
| FUNCTION | DESCRIPTION |
|---|---|
clean_app_job_list |
Remove from a job list all jobs with status different from submitted. |
Classes
Functions:
_check_project_exists(*, project_name, user_id, db)
async
Check that no other project with this name exists for this user.
| PARAMETER | DESCRIPTION |
|---|---|
|
Project name
TYPE:
|
|
User ID
TYPE:
|
|
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
HTTPException(status_code=422_UNPROCESSABLE_ENTITY)
|
If such a project already exists |
Source code in fractal_server/app/routes/api/v2/_aux_functions.py
_check_workflow_exists(*, name, project_id, db)
async
Check that no other workflow of this project has the same name.
| PARAMETER | DESCRIPTION |
|---|---|
|
Workflow name
TYPE:
|
|
Project ID
TYPE:
|
|
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
HTTPException(status_code=422_UNPROCESSABLE_ENTITY)
|
If such a workflow already exists |
Source code in fractal_server/app/routes/api/v2/_aux_functions.py
_create_workflow_export(workflow, db)
async
Return the export representation of a workflow.
Source code in fractal_server/app/routes/api/v2/_aux_functions.py
_get_dataset_check_access(*, project_id, dataset_id, user_id, required_permissions, db)
async
Get a dataset and a project, after access control on the project
| PARAMETER | DESCRIPTION |
|---|---|
|
TYPE:
|
|
TYPE:
|
|
TYPE:
|
|
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
DatasetOrProject
|
Dictionary with the dataset and project objects (keys: |
| RAISES | DESCRIPTION |
|---|---|
HTTPException(status_code=404_UNPROCESSABLE_ENTITY)
|
If the project or the dataset do not exist or if they are not associated |
HTTPException(status_code=403_FORBIDDEN)
|
If the user is not a member of the project |
Source code in fractal_server/app/routes/api/v2/_aux_functions.py
_get_dataset_or_404(*, dataset_id, db)
async
Get a dataset or raise 404.
| PARAMETER | DESCRIPTION |
|---|---|
|
TYPE:
|
|
TYPE:
|
Source code in fractal_server/app/routes/api/v2/_aux_functions.py
_get_job_check_access(*, project_id, job_id, user_id, required_permissions, db)
async
Get a job and a project, after access control on the project
| PARAMETER | DESCRIPTION |
|---|---|
|
TYPE:
|
|
TYPE:
|
|
TYPE:
|
|
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
JobAndProject
|
Dictionary with the job and project objects (keys: |
| RAISES | DESCRIPTION |
|---|---|
HTTPException(status_code=404_UNPROCESSABLE_ENTITY)
|
If the project or the job do not exist or if they are not associated |
HTTPException(status_code=403_FORBIDDEN)
|
If the user is not a member of the project |
Source code in fractal_server/app/routes/api/v2/_aux_functions.py
_get_project_check_access(*, project_id, user_id, required_permissions, db)
async
Check that user is a member of project and return the project.
| PARAMETER | DESCRIPTION |
|---|---|
|
TYPE:
|
|
TYPE:
|
|
TYPE:
|
|
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ProjectV2
|
The project object |
| RAISES | DESCRIPTION |
|---|---|
HTTPException(status_code=403_FORBIDDEN)
|
|
HTTPException(status_code=404_NOT_FOUND)
|
If the project does not exist |
Source code in fractal_server/app/routes/api/v2/_aux_functions.py
_get_submitted_jobs_statement()
| RETURNS | DESCRIPTION |
|---|---|
Select
|
A statement that selects all |
Select
|
|
Source code in fractal_server/app/routes/api/v2/_aux_functions.py
_get_workflow_check_access(*, workflow_id, project_id, user_id, required_permissions, db)
async
Get a workflow and a project, after access control on the project.
| PARAMETER | DESCRIPTION |
|---|---|
|
TYPE:
|
|
TYPE:
|
|
TYPE:
|
|
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
WorkflowV2
|
The workflow object. |
| RAISES | DESCRIPTION |
|---|---|
HTTPException(status_code=404_NOT_FOUND)
|
If the project or the workflow do not exist or if they are not associated |
HTTPException(status_code=403_FORBIDDEN)
|
If the user is not a member of the project |
Source code in fractal_server/app/routes/api/v2/_aux_functions.py
_get_workflow_or_404(*, workflow_id, db)
async
Get a workflow or raise 404.
| PARAMETER | DESCRIPTION |
|---|---|
|
TYPE:
|
|
TYPE:
|
Source code in fractal_server/app/routes/api/v2/_aux_functions.py
_get_workflow_task_check_access(*, project_id, workflow_id, workflow_task_id, user_id, required_permissions, db)
async
Check that user has access to Workflow and WorkflowTask.
| PARAMETER | DESCRIPTION |
|---|---|
|
TYPE:
|
|
TYPE:
|
|
TYPE:
|
|
TYPE:
|
|
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
tuple[WorkflowTaskV2, WorkflowV2]
|
Tuple of WorkflowTask and Workflow objects. |
| RAISES | DESCRIPTION |
|---|---|
HTTPException(status_code=404_NOT_FOUND)
|
If the project, the workflow or the workflowtask do not exist or if they are not associated |
HTTPException(status_code=403_FORBIDDEN)
|
If the user is not a member of the project |
Source code in fractal_server/app/routes/api/v2/_aux_functions.py
_get_workflowtask_or_404(*, workflowtask_id, db)
async
Get a workflow task or raise 404.
| PARAMETER | DESCRIPTION |
|---|---|
|
TYPE:
|
|
TYPE:
|
Source code in fractal_server/app/routes/api/v2/_aux_functions.py
_workflow_insert_task(*, workflow_id, task_id, order, meta_parallel=None, meta_non_parallel=None, args_non_parallel=None, args_parallel=None, type_filters=None, description=None, alias=None, db)
async
Insert a new WorkflowTask into Workflow.task_list
| PARAMETER | DESCRIPTION |
|---|---|
|
TYPE:
|
|
TYPE:
|
|
TYPE:
|
|
|
|
|
|
|
|
|
|
|
|
TYPE:
|
|
TYPE:
|
|
TYPE:
|
Source code in fractal_server/app/routes/api/v2/_aux_functions.py
397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 | |
clean_app_job_list(db, jobs_list)
async
Remove from a job list all jobs with status different from submitted.
| PARAMETER | DESCRIPTION |
|---|---|
|
Async database session
TYPE:
|
|
List of job IDs currently associated to the app. |
Return
List of IDs for submitted jobs.