plexus-python-pulse-demeter 1.1.134__py3-none-any.whl → 1.1.136__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.
- plexus/pulse/demeter/app/api/__init__.py +2 -0
- plexus/pulse/demeter/app/api/pipeline_endpoints.py +1 -1
- plexus/pulse/demeter/app/api/pipeline_internal_endpoints.py +560 -0
- plexus/pulse/demeter/app/api/pipeline_metrics_endpoints.py +175 -0
- plexus/pulse/demeter/app/models/pipeline.py +1516 -71
- plexus/pulse/demeter/utils/flowutils.py +787 -28
- {plexus_python_pulse_demeter-1.1.134.dist-info → plexus_python_pulse_demeter-1.1.136.dist-info}/METADATA +2 -1
- {plexus_python_pulse_demeter-1.1.134.dist-info → plexus_python_pulse_demeter-1.1.136.dist-info}/RECORD +11 -10
- {plexus_python_pulse_demeter-1.1.134.dist-info → plexus_python_pulse_demeter-1.1.136.dist-info}/WHEEL +0 -0
- {plexus_python_pulse_demeter-1.1.134.dist-info → plexus_python_pulse_demeter-1.1.136.dist-info}/entry_points.txt +0 -0
- {plexus_python_pulse_demeter-1.1.134.dist-info → plexus_python_pulse_demeter-1.1.136.dist-info}/top_level.txt +0 -0
|
@@ -90,6 +90,7 @@ def make_api() -> FastAPI:
|
|
|
90
90
|
from plexus.pulse.demeter.app.api.catalog_internal_endpoints import router as catalog_internal_router
|
|
91
91
|
from plexus.pulse.demeter.app.api.workflow_internal_endpoints import router as workflow_internal_router
|
|
92
92
|
from plexus.pulse.demeter.app.api.pipeline_internal_endpoints import router as pipeline_internal_router
|
|
93
|
+
from plexus.pulse.demeter.app.api.pipeline_metrics_endpoints import router as pipeline_metrics_router
|
|
93
94
|
|
|
94
95
|
api = FastAPI(title="Pulse Demeter API", description="API for Pulse Demeter")
|
|
95
96
|
api.add_middleware(
|
|
@@ -110,5 +111,6 @@ def make_api() -> FastAPI:
|
|
|
110
111
|
api.include_router(catalog_internal_router)
|
|
111
112
|
api.include_router(workflow_internal_router)
|
|
112
113
|
api.include_router(pipeline_internal_router)
|
|
114
|
+
api.include_router(pipeline_metrics_router)
|
|
113
115
|
|
|
114
116
|
return api
|
|
@@ -494,7 +494,7 @@ def checkout_stage_run(
|
|
|
494
494
|
status="QUEUED",
|
|
495
495
|
created_at=current_dt,
|
|
496
496
|
updated_at=current_dt)
|
|
497
|
-
.on_conflict_do_nothing(constraint="
|
|
497
|
+
.on_conflict_do_nothing(constraint="uq_stage_run_pipeline_name_stage_dedup_key")
|
|
498
498
|
)
|
|
499
499
|
db_stage_run = (
|
|
500
500
|
db
|
|
@@ -9,16 +9,38 @@ from plexus.pulse.common.utils.apiutils import database_transaction
|
|
|
9
9
|
from plexus.pulse.common.utils.ormutils import (
|
|
10
10
|
db_create_changing_model,
|
|
11
11
|
db_create_changing_models,
|
|
12
|
+
db_create_revision_model,
|
|
13
|
+
db_create_revision_models,
|
|
12
14
|
db_delete_sequence_model,
|
|
15
|
+
db_expire_revision_model,
|
|
16
|
+
db_read_active_revision_model_of_record,
|
|
17
|
+
db_read_active_revision_models,
|
|
13
18
|
db_read_sequence_model,
|
|
14
19
|
db_read_sequence_models,
|
|
15
20
|
db_update_changing_model,
|
|
21
|
+
db_update_revision_model,
|
|
16
22
|
)
|
|
17
23
|
|
|
18
24
|
from plexus.pulse.demeter.app.core.database import make_session
|
|
19
25
|
from plexus.pulse.demeter.app.models.pipeline import (
|
|
26
|
+
Annotation,
|
|
27
|
+
AnnotationFormatSpec,
|
|
28
|
+
AnnotationFormatSpecTable,
|
|
29
|
+
AnnotationTable,
|
|
30
|
+
Bag,
|
|
31
|
+
BagFormatSpec,
|
|
32
|
+
BagFormatSpecTable,
|
|
33
|
+
BagTable,
|
|
34
|
+
Episode,
|
|
35
|
+
EpisodeFormatSpec,
|
|
36
|
+
EpisodeFormatSpecTable,
|
|
37
|
+
EpisodeTable,
|
|
20
38
|
Pipeline,
|
|
21
39
|
PipelineTable,
|
|
40
|
+
Robot,
|
|
41
|
+
RobotSetupSpec,
|
|
42
|
+
RobotSetupSpecTable,
|
|
43
|
+
RobotTable,
|
|
22
44
|
StageBatch,
|
|
23
45
|
StageBatchTable,
|
|
24
46
|
StageInput,
|
|
@@ -31,6 +53,10 @@ from plexus.pulse.demeter.app.models.pipeline import (
|
|
|
31
53
|
StageRunAttempt,
|
|
32
54
|
StageRunAttemptTable,
|
|
33
55
|
StageRunTable,
|
|
56
|
+
Tag,
|
|
57
|
+
TagTable,
|
|
58
|
+
Tagset,
|
|
59
|
+
TagsetTable,
|
|
34
60
|
)
|
|
35
61
|
|
|
36
62
|
router = APIRouter(prefix="/pulse_demeter/internal/pipeline", tags=["internal"])
|
|
@@ -418,3 +444,537 @@ def update_stage_input_attempt(
|
|
|
418
444
|
def delete_stage_input_attempt(sqn: int, db: sa_orm.Session = Depends(make_session)) -> StageInputAttemptTable:
|
|
419
445
|
with database_transaction(db, redirect=exception_redirect):
|
|
420
446
|
return db_delete_sequence_model(db, StageInputAttemptTable, sqn)
|
|
447
|
+
|
|
448
|
+
|
|
449
|
+
@router.post("/robot_setup_spec/", response_model=RobotSetupSpecTable)
|
|
450
|
+
def create_robot_setup_spec(
|
|
451
|
+
robot_setup_spec: RobotSetupSpec,
|
|
452
|
+
created_at: datetime.datetime = Query(default_factory=dt_utc_now),
|
|
453
|
+
db: sa_orm.Session = Depends(make_session),
|
|
454
|
+
) -> RobotSetupSpecTable:
|
|
455
|
+
with database_transaction(db, redirect=exception_redirect):
|
|
456
|
+
return db_create_changing_model(db, RobotSetupSpecTable, robot_setup_spec, created_at)
|
|
457
|
+
|
|
458
|
+
|
|
459
|
+
@router.post("/robot_setup_specs/", response_model=list[RobotSetupSpecTable])
|
|
460
|
+
def create_robot_setup_specs(
|
|
461
|
+
robot_setup_specs: list[RobotSetupSpec],
|
|
462
|
+
created_at: datetime.datetime = Query(default_factory=dt_utc_now),
|
|
463
|
+
db: sa_orm.Session = Depends(make_session),
|
|
464
|
+
) -> list[RobotSetupSpecTable]:
|
|
465
|
+
with database_transaction(db, redirect=exception_redirect):
|
|
466
|
+
return db_create_changing_models(db, RobotSetupSpecTable, robot_setup_specs, created_at)
|
|
467
|
+
|
|
468
|
+
|
|
469
|
+
@router.get("/robot_setup_spec/{sqn}", response_model=RobotSetupSpecTable)
|
|
470
|
+
def read_robot_setup_spec(sqn: int, db: sa_orm.Session = Depends(make_session)) -> RobotSetupSpecTable:
|
|
471
|
+
with database_transaction(db, redirect=exception_redirect):
|
|
472
|
+
return db_read_sequence_model(db, RobotSetupSpecTable, sqn)
|
|
473
|
+
|
|
474
|
+
|
|
475
|
+
@router.get("/robot_setup_specs/", response_model=list[RobotSetupSpecTable])
|
|
476
|
+
def read_robot_setup_specs(
|
|
477
|
+
skip: int = Query(0, ge=0),
|
|
478
|
+
limit: int = Query(1000, ge=1, le=1000),
|
|
479
|
+
db: sa_orm.Session = Depends(make_session),
|
|
480
|
+
) -> list[RobotSetupSpecTable]:
|
|
481
|
+
with database_transaction(db, redirect=exception_redirect):
|
|
482
|
+
return db_read_sequence_models(db, RobotSetupSpecTable, skip, limit)
|
|
483
|
+
|
|
484
|
+
|
|
485
|
+
@router.put("/robot_setup_spec/{sqn}", response_model=RobotSetupSpecTable)
|
|
486
|
+
def update_robot_setup_spec(
|
|
487
|
+
sqn: int,
|
|
488
|
+
robot_setup_spec: RobotSetupSpec,
|
|
489
|
+
updated_at: datetime.datetime = Query(default_factory=dt_utc_now),
|
|
490
|
+
db: sa_orm.Session = Depends(make_session),
|
|
491
|
+
) -> RobotSetupSpecTable:
|
|
492
|
+
with database_transaction(db, redirect=exception_redirect):
|
|
493
|
+
return db_update_changing_model(db, RobotSetupSpecTable, robot_setup_spec, sqn, updated_at)
|
|
494
|
+
|
|
495
|
+
|
|
496
|
+
@router.delete("/robot_setup_spec/{sqn}", response_model=RobotSetupSpecTable)
|
|
497
|
+
def delete_robot_setup_spec(sqn: int, db: sa_orm.Session = Depends(make_session)) -> RobotSetupSpecTable:
|
|
498
|
+
with database_transaction(db, redirect=exception_redirect):
|
|
499
|
+
return db_delete_sequence_model(db, RobotSetupSpecTable, sqn)
|
|
500
|
+
|
|
501
|
+
|
|
502
|
+
@router.post("/robot/", response_model=RobotTable)
|
|
503
|
+
def create_robot(
|
|
504
|
+
robot: Robot,
|
|
505
|
+
created_at: datetime.datetime = Query(default_factory=dt_utc_now),
|
|
506
|
+
db: sa_orm.Session = Depends(make_session),
|
|
507
|
+
) -> RobotTable:
|
|
508
|
+
with database_transaction(db, redirect=exception_redirect):
|
|
509
|
+
return db_create_revision_model(db, RobotTable, robot, created_at)
|
|
510
|
+
|
|
511
|
+
|
|
512
|
+
@router.post("/robots/", response_model=list[RobotTable])
|
|
513
|
+
def create_robots(
|
|
514
|
+
robots: list[Robot],
|
|
515
|
+
created_at: datetime.datetime = Query(default_factory=dt_utc_now),
|
|
516
|
+
db: sa_orm.Session = Depends(make_session),
|
|
517
|
+
) -> list[RobotTable]:
|
|
518
|
+
with database_transaction(db, redirect=exception_redirect):
|
|
519
|
+
return db_create_revision_models(db, RobotTable, robots, created_at)
|
|
520
|
+
|
|
521
|
+
|
|
522
|
+
@router.get("/robot/{record_sqn}", response_model=RobotTable)
|
|
523
|
+
def read_robot(record_sqn: int, db: sa_orm.Session = Depends(make_session)) -> RobotTable:
|
|
524
|
+
with database_transaction(db, redirect=exception_redirect):
|
|
525
|
+
return db_read_active_revision_model_of_record(db, RobotTable, record_sqn)
|
|
526
|
+
|
|
527
|
+
|
|
528
|
+
@router.get("/robots/", response_model=list[RobotTable])
|
|
529
|
+
def read_robots(
|
|
530
|
+
skip: int = Query(0, ge=0),
|
|
531
|
+
limit: int = Query(1000, ge=1, le=1000),
|
|
532
|
+
db: sa_orm.Session = Depends(make_session),
|
|
533
|
+
) -> list[RobotTable]:
|
|
534
|
+
with database_transaction(db, redirect=exception_redirect):
|
|
535
|
+
return db_read_active_revision_models(db, RobotTable, skip, limit)
|
|
536
|
+
|
|
537
|
+
|
|
538
|
+
@router.put("/robot/{record_sqn}", response_model=RobotTable)
|
|
539
|
+
def update_robot(
|
|
540
|
+
record_sqn: int,
|
|
541
|
+
robot: Robot,
|
|
542
|
+
updated_at: datetime.datetime = Query(default_factory=dt_utc_now),
|
|
543
|
+
db: sa_orm.Session = Depends(make_session),
|
|
544
|
+
) -> RobotTable:
|
|
545
|
+
with database_transaction(db, redirect=exception_redirect):
|
|
546
|
+
return db_update_revision_model(db, RobotTable, robot, record_sqn, updated_at)
|
|
547
|
+
|
|
548
|
+
|
|
549
|
+
@router.delete("/robot/{record_sqn}", response_model=RobotTable)
|
|
550
|
+
def delete_robot(
|
|
551
|
+
record_sqn: int,
|
|
552
|
+
updated_at: datetime.datetime = Query(default_factory=dt_utc_now),
|
|
553
|
+
db: sa_orm.Session = Depends(make_session),
|
|
554
|
+
) -> RobotTable:
|
|
555
|
+
with database_transaction(db, redirect=exception_redirect):
|
|
556
|
+
return db_expire_revision_model(db, RobotTable, record_sqn, updated_at)
|
|
557
|
+
|
|
558
|
+
|
|
559
|
+
@router.post("/bag_format_spec/", response_model=BagFormatSpecTable)
|
|
560
|
+
def create_bag_format_spec(
|
|
561
|
+
bag_format_spec: BagFormatSpec,
|
|
562
|
+
created_at: datetime.datetime = Query(default_factory=dt_utc_now),
|
|
563
|
+
db: sa_orm.Session = Depends(make_session),
|
|
564
|
+
) -> BagFormatSpecTable:
|
|
565
|
+
with database_transaction(db, redirect=exception_redirect):
|
|
566
|
+
return db_create_changing_model(db, BagFormatSpecTable, bag_format_spec, created_at)
|
|
567
|
+
|
|
568
|
+
|
|
569
|
+
@router.post("/bag_format_specs/", response_model=list[BagFormatSpecTable])
|
|
570
|
+
def create_bag_format_specs(
|
|
571
|
+
bag_format_specs: list[BagFormatSpec],
|
|
572
|
+
created_at: datetime.datetime = Query(default_factory=dt_utc_now),
|
|
573
|
+
db: sa_orm.Session = Depends(make_session),
|
|
574
|
+
) -> list[BagFormatSpecTable]:
|
|
575
|
+
with database_transaction(db, redirect=exception_redirect):
|
|
576
|
+
return db_create_changing_models(db, BagFormatSpecTable, bag_format_specs, created_at)
|
|
577
|
+
|
|
578
|
+
|
|
579
|
+
@router.get("/bag_format_spec/{sqn}", response_model=BagFormatSpecTable)
|
|
580
|
+
def read_bag_format_spec(sqn: int, db: sa_orm.Session = Depends(make_session)) -> BagFormatSpecTable:
|
|
581
|
+
with database_transaction(db, redirect=exception_redirect):
|
|
582
|
+
return db_read_sequence_model(db, BagFormatSpecTable, sqn)
|
|
583
|
+
|
|
584
|
+
|
|
585
|
+
@router.get("/bag_format_specs/", response_model=list[BagFormatSpecTable])
|
|
586
|
+
def read_bag_format_specs(
|
|
587
|
+
skip: int = Query(0, ge=0),
|
|
588
|
+
limit: int = Query(1000, ge=1, le=1000),
|
|
589
|
+
db: sa_orm.Session = Depends(make_session),
|
|
590
|
+
) -> list[BagFormatSpecTable]:
|
|
591
|
+
with database_transaction(db, redirect=exception_redirect):
|
|
592
|
+
return db_read_sequence_models(db, BagFormatSpecTable, skip, limit)
|
|
593
|
+
|
|
594
|
+
|
|
595
|
+
@router.put("/bag_format_spec/{sqn}", response_model=BagFormatSpecTable)
|
|
596
|
+
def update_bag_format_spec(
|
|
597
|
+
sqn: int,
|
|
598
|
+
bag_format_spec: BagFormatSpec,
|
|
599
|
+
updated_at: datetime.datetime = Query(default_factory=dt_utc_now),
|
|
600
|
+
db: sa_orm.Session = Depends(make_session),
|
|
601
|
+
) -> BagFormatSpecTable:
|
|
602
|
+
with database_transaction(db, redirect=exception_redirect):
|
|
603
|
+
return db_update_changing_model(db, BagFormatSpecTable, bag_format_spec, sqn, updated_at)
|
|
604
|
+
|
|
605
|
+
|
|
606
|
+
@router.delete("/bag_format_spec/{sqn}", response_model=BagFormatSpecTable)
|
|
607
|
+
def delete_bag_format_spec(sqn: int, db: sa_orm.Session = Depends(make_session)) -> BagFormatSpecTable:
|
|
608
|
+
with database_transaction(db, redirect=exception_redirect):
|
|
609
|
+
return db_delete_sequence_model(db, BagFormatSpecTable, sqn)
|
|
610
|
+
|
|
611
|
+
|
|
612
|
+
@router.post("/bag/", response_model=BagTable)
|
|
613
|
+
def create_bag(
|
|
614
|
+
bag: Bag,
|
|
615
|
+
created_at: datetime.datetime = Query(default_factory=dt_utc_now),
|
|
616
|
+
db: sa_orm.Session = Depends(make_session),
|
|
617
|
+
) -> BagTable:
|
|
618
|
+
with database_transaction(db, redirect=exception_redirect):
|
|
619
|
+
return db_create_changing_model(db, BagTable, bag, created_at)
|
|
620
|
+
|
|
621
|
+
|
|
622
|
+
@router.post("/bags/", response_model=list[BagTable])
|
|
623
|
+
def create_bags(
|
|
624
|
+
bags: list[Bag],
|
|
625
|
+
created_at: datetime.datetime = Query(default_factory=dt_utc_now),
|
|
626
|
+
db: sa_orm.Session = Depends(make_session),
|
|
627
|
+
) -> list[BagTable]:
|
|
628
|
+
with database_transaction(db, redirect=exception_redirect):
|
|
629
|
+
return db_create_changing_models(db, BagTable, bags, created_at)
|
|
630
|
+
|
|
631
|
+
|
|
632
|
+
@router.get("/bag/{sqn}", response_model=BagTable)
|
|
633
|
+
def read_bag(sqn: int, db: sa_orm.Session = Depends(make_session)) -> BagTable:
|
|
634
|
+
with database_transaction(db, redirect=exception_redirect):
|
|
635
|
+
return db_read_sequence_model(db, BagTable, sqn)
|
|
636
|
+
|
|
637
|
+
|
|
638
|
+
@router.get("/bags/", response_model=list[BagTable])
|
|
639
|
+
def read_bags(
|
|
640
|
+
skip: int = Query(0, ge=0),
|
|
641
|
+
limit: int = Query(1000, ge=1, le=1000),
|
|
642
|
+
db: sa_orm.Session = Depends(make_session),
|
|
643
|
+
) -> list[BagTable]:
|
|
644
|
+
with database_transaction(db, redirect=exception_redirect):
|
|
645
|
+
return db_read_sequence_models(db, BagTable, skip, limit)
|
|
646
|
+
|
|
647
|
+
|
|
648
|
+
@router.put("/bag/{sqn}", response_model=BagTable)
|
|
649
|
+
def update_bag(
|
|
650
|
+
sqn: int,
|
|
651
|
+
bag: Bag,
|
|
652
|
+
updated_at: datetime.datetime = Query(default_factory=dt_utc_now),
|
|
653
|
+
db: sa_orm.Session = Depends(make_session),
|
|
654
|
+
) -> BagTable:
|
|
655
|
+
with database_transaction(db, redirect=exception_redirect):
|
|
656
|
+
return db_update_changing_model(db, BagTable, bag, sqn, updated_at)
|
|
657
|
+
|
|
658
|
+
|
|
659
|
+
@router.delete("/bag/{sqn}", response_model=BagTable)
|
|
660
|
+
def delete_bag(sqn: int, db: sa_orm.Session = Depends(make_session)) -> BagTable:
|
|
661
|
+
with database_transaction(db, redirect=exception_redirect):
|
|
662
|
+
return db_delete_sequence_model(db, BagTable, sqn)
|
|
663
|
+
|
|
664
|
+
|
|
665
|
+
@router.post("/episode_format_spec/", response_model=EpisodeFormatSpecTable)
|
|
666
|
+
def create_episode_format_spec(
|
|
667
|
+
episode_format_spec: EpisodeFormatSpec,
|
|
668
|
+
created_at: datetime.datetime = Query(default_factory=dt_utc_now),
|
|
669
|
+
db: sa_orm.Session = Depends(make_session),
|
|
670
|
+
) -> EpisodeFormatSpecTable:
|
|
671
|
+
with database_transaction(db, redirect=exception_redirect):
|
|
672
|
+
return db_create_changing_model(db, EpisodeFormatSpecTable, episode_format_spec, created_at)
|
|
673
|
+
|
|
674
|
+
|
|
675
|
+
@router.post("/episode_format_specs/", response_model=list[EpisodeFormatSpecTable])
|
|
676
|
+
def create_episode_format_specs(
|
|
677
|
+
episode_format_specs: list[EpisodeFormatSpec],
|
|
678
|
+
created_at: datetime.datetime = Query(default_factory=dt_utc_now),
|
|
679
|
+
db: sa_orm.Session = Depends(make_session),
|
|
680
|
+
) -> list[EpisodeFormatSpecTable]:
|
|
681
|
+
with database_transaction(db, redirect=exception_redirect):
|
|
682
|
+
return db_create_changing_models(db, EpisodeFormatSpecTable, episode_format_specs, created_at)
|
|
683
|
+
|
|
684
|
+
|
|
685
|
+
@router.get("/episode_format_spec/{sqn}", response_model=EpisodeFormatSpecTable)
|
|
686
|
+
def read_episode_format_spec(sqn: int, db: sa_orm.Session = Depends(make_session)) -> EpisodeFormatSpecTable:
|
|
687
|
+
with database_transaction(db, redirect=exception_redirect):
|
|
688
|
+
return db_read_sequence_model(db, EpisodeFormatSpecTable, sqn)
|
|
689
|
+
|
|
690
|
+
|
|
691
|
+
@router.get("/episode_format_specs/", response_model=list[EpisodeFormatSpecTable])
|
|
692
|
+
def read_episode_format_specs(
|
|
693
|
+
skip: int = Query(0, ge=0),
|
|
694
|
+
limit: int = Query(1000, ge=1, le=1000),
|
|
695
|
+
db: sa_orm.Session = Depends(make_session),
|
|
696
|
+
) -> list[EpisodeFormatSpecTable]:
|
|
697
|
+
with database_transaction(db, redirect=exception_redirect):
|
|
698
|
+
return db_read_sequence_models(db, EpisodeFormatSpecTable, skip, limit)
|
|
699
|
+
|
|
700
|
+
|
|
701
|
+
@router.put("/episode_format_spec/{sqn}", response_model=EpisodeFormatSpecTable)
|
|
702
|
+
def update_episode_format_spec(
|
|
703
|
+
sqn: int,
|
|
704
|
+
episode_format_spec: EpisodeFormatSpec,
|
|
705
|
+
updated_at: datetime.datetime = Query(default_factory=dt_utc_now),
|
|
706
|
+
db: sa_orm.Session = Depends(make_session),
|
|
707
|
+
) -> EpisodeFormatSpecTable:
|
|
708
|
+
with database_transaction(db, redirect=exception_redirect):
|
|
709
|
+
return db_update_changing_model(db, EpisodeFormatSpecTable, episode_format_spec, sqn, updated_at)
|
|
710
|
+
|
|
711
|
+
|
|
712
|
+
@router.delete("/episode_format_spec/{sqn}", response_model=EpisodeFormatSpecTable)
|
|
713
|
+
def delete_episode_format_spec(sqn: int, db: sa_orm.Session = Depends(make_session)) -> EpisodeFormatSpecTable:
|
|
714
|
+
with database_transaction(db, redirect=exception_redirect):
|
|
715
|
+
return db_delete_sequence_model(db, EpisodeFormatSpecTable, sqn)
|
|
716
|
+
|
|
717
|
+
|
|
718
|
+
@router.post("/episode/", response_model=EpisodeTable)
|
|
719
|
+
def create_episode(
|
|
720
|
+
episode: Episode,
|
|
721
|
+
created_at: datetime.datetime = Query(default_factory=dt_utc_now),
|
|
722
|
+
db: sa_orm.Session = Depends(make_session),
|
|
723
|
+
) -> EpisodeTable:
|
|
724
|
+
with database_transaction(db, redirect=exception_redirect):
|
|
725
|
+
return db_create_changing_model(db, EpisodeTable, episode, created_at)
|
|
726
|
+
|
|
727
|
+
|
|
728
|
+
@router.post("/episodes/", response_model=list[EpisodeTable])
|
|
729
|
+
def create_episodes(
|
|
730
|
+
episodes: list[Episode],
|
|
731
|
+
created_at: datetime.datetime = Query(default_factory=dt_utc_now),
|
|
732
|
+
db: sa_orm.Session = Depends(make_session),
|
|
733
|
+
) -> list[EpisodeTable]:
|
|
734
|
+
with database_transaction(db, redirect=exception_redirect):
|
|
735
|
+
return db_create_changing_models(db, EpisodeTable, episodes, created_at)
|
|
736
|
+
|
|
737
|
+
|
|
738
|
+
@router.get("/episode/{sqn}", response_model=EpisodeTable)
|
|
739
|
+
def read_episode(sqn: int, db: sa_orm.Session = Depends(make_session)) -> EpisodeTable:
|
|
740
|
+
with database_transaction(db, redirect=exception_redirect):
|
|
741
|
+
return db_read_sequence_model(db, EpisodeTable, sqn)
|
|
742
|
+
|
|
743
|
+
|
|
744
|
+
@router.get("/episodes/", response_model=list[EpisodeTable])
|
|
745
|
+
def read_episodes(
|
|
746
|
+
skip: int = Query(0, ge=0),
|
|
747
|
+
limit: int = Query(1000, ge=1, le=1000),
|
|
748
|
+
db: sa_orm.Session = Depends(make_session),
|
|
749
|
+
) -> list[EpisodeTable]:
|
|
750
|
+
with database_transaction(db, redirect=exception_redirect):
|
|
751
|
+
return db_read_sequence_models(db, EpisodeTable, skip, limit)
|
|
752
|
+
|
|
753
|
+
|
|
754
|
+
@router.put("/episode/{sqn}", response_model=EpisodeTable)
|
|
755
|
+
def update_episode(
|
|
756
|
+
sqn: int,
|
|
757
|
+
episode: Episode,
|
|
758
|
+
updated_at: datetime.datetime = Query(default_factory=dt_utc_now),
|
|
759
|
+
db: sa_orm.Session = Depends(make_session),
|
|
760
|
+
) -> EpisodeTable:
|
|
761
|
+
with database_transaction(db, redirect=exception_redirect):
|
|
762
|
+
return db_update_changing_model(db, EpisodeTable, episode, sqn, updated_at)
|
|
763
|
+
|
|
764
|
+
|
|
765
|
+
@router.delete("/episode/{sqn}", response_model=EpisodeTable)
|
|
766
|
+
def delete_episode(sqn: int, db: sa_orm.Session = Depends(make_session)) -> EpisodeTable:
|
|
767
|
+
with database_transaction(db, redirect=exception_redirect):
|
|
768
|
+
return db_delete_sequence_model(db, EpisodeTable, sqn)
|
|
769
|
+
|
|
770
|
+
|
|
771
|
+
@router.post("/annotation_format_spec/", response_model=AnnotationFormatSpecTable)
|
|
772
|
+
def create_annotation_format_spec(
|
|
773
|
+
annotation_format_spec: AnnotationFormatSpec,
|
|
774
|
+
created_at: datetime.datetime = Query(default_factory=dt_utc_now),
|
|
775
|
+
db: sa_orm.Session = Depends(make_session),
|
|
776
|
+
) -> AnnotationFormatSpecTable:
|
|
777
|
+
with database_transaction(db, redirect=exception_redirect):
|
|
778
|
+
return db_create_changing_model(db, AnnotationFormatSpecTable, annotation_format_spec, created_at)
|
|
779
|
+
|
|
780
|
+
|
|
781
|
+
@router.post("/annotation_format_specs/", response_model=list[AnnotationFormatSpecTable])
|
|
782
|
+
def create_annotation_format_specs(
|
|
783
|
+
annotation_format_specs: list[AnnotationFormatSpec],
|
|
784
|
+
created_at: datetime.datetime = Query(default_factory=dt_utc_now),
|
|
785
|
+
db: sa_orm.Session = Depends(make_session),
|
|
786
|
+
) -> list[AnnotationFormatSpecTable]:
|
|
787
|
+
with database_transaction(db, redirect=exception_redirect):
|
|
788
|
+
return db_create_changing_models(db, AnnotationFormatSpecTable, annotation_format_specs, created_at)
|
|
789
|
+
|
|
790
|
+
|
|
791
|
+
@router.get("/annotation_format_spec/{sqn}", response_model=AnnotationFormatSpecTable)
|
|
792
|
+
def read_annotation_format_spec(sqn: int, db: sa_orm.Session = Depends(make_session)) -> AnnotationFormatSpecTable:
|
|
793
|
+
with database_transaction(db, redirect=exception_redirect):
|
|
794
|
+
return db_read_sequence_model(db, AnnotationFormatSpecTable, sqn)
|
|
795
|
+
|
|
796
|
+
|
|
797
|
+
@router.get("/annotation_format_specs/", response_model=list[AnnotationFormatSpecTable])
|
|
798
|
+
def read_annotation_format_specs(
|
|
799
|
+
skip: int = Query(0, ge=0),
|
|
800
|
+
limit: int = Query(1000, ge=1, le=1000),
|
|
801
|
+
db: sa_orm.Session = Depends(make_session),
|
|
802
|
+
) -> list[AnnotationFormatSpecTable]:
|
|
803
|
+
with database_transaction(db, redirect=exception_redirect):
|
|
804
|
+
return db_read_sequence_models(db, AnnotationFormatSpecTable, skip, limit)
|
|
805
|
+
|
|
806
|
+
|
|
807
|
+
@router.put("/annotation_format_spec/{sqn}", response_model=AnnotationFormatSpecTable)
|
|
808
|
+
def update_annotation_format_spec(
|
|
809
|
+
sqn: int,
|
|
810
|
+
annotation_format_spec: AnnotationFormatSpec,
|
|
811
|
+
updated_at: datetime.datetime = Query(default_factory=dt_utc_now),
|
|
812
|
+
db: sa_orm.Session = Depends(make_session),
|
|
813
|
+
) -> AnnotationFormatSpecTable:
|
|
814
|
+
with database_transaction(db, redirect=exception_redirect):
|
|
815
|
+
return db_update_changing_model(db, AnnotationFormatSpecTable, annotation_format_spec, sqn, updated_at)
|
|
816
|
+
|
|
817
|
+
|
|
818
|
+
@router.delete("/annotation_format_spec/{sqn}", response_model=AnnotationFormatSpecTable)
|
|
819
|
+
def delete_annotation_format_spec(sqn: int, db: sa_orm.Session = Depends(make_session)) -> AnnotationFormatSpecTable:
|
|
820
|
+
with database_transaction(db, redirect=exception_redirect):
|
|
821
|
+
return db_delete_sequence_model(db, AnnotationFormatSpecTable, sqn)
|
|
822
|
+
|
|
823
|
+
|
|
824
|
+
@router.post("/annotation/", response_model=AnnotationTable)
|
|
825
|
+
def create_annotation(
|
|
826
|
+
annotation: Annotation,
|
|
827
|
+
created_at: datetime.datetime = Query(default_factory=dt_utc_now),
|
|
828
|
+
db: sa_orm.Session = Depends(make_session),
|
|
829
|
+
) -> AnnotationTable:
|
|
830
|
+
with database_transaction(db, redirect=exception_redirect):
|
|
831
|
+
return db_create_changing_model(db, AnnotationTable, annotation, created_at)
|
|
832
|
+
|
|
833
|
+
|
|
834
|
+
@router.post("/annotations/", response_model=list[AnnotationTable])
|
|
835
|
+
def create_annotations(
|
|
836
|
+
annotations: list[Annotation],
|
|
837
|
+
created_at: datetime.datetime = Query(default_factory=dt_utc_now),
|
|
838
|
+
db: sa_orm.Session = Depends(make_session),
|
|
839
|
+
) -> list[AnnotationTable]:
|
|
840
|
+
with database_transaction(db, redirect=exception_redirect):
|
|
841
|
+
return db_create_changing_models(db, AnnotationTable, annotations, created_at)
|
|
842
|
+
|
|
843
|
+
|
|
844
|
+
@router.get("/annotation/{sqn}", response_model=AnnotationTable)
|
|
845
|
+
def read_annotation(sqn: int, db: sa_orm.Session = Depends(make_session)) -> AnnotationTable:
|
|
846
|
+
with database_transaction(db, redirect=exception_redirect):
|
|
847
|
+
return db_read_sequence_model(db, AnnotationTable, sqn)
|
|
848
|
+
|
|
849
|
+
|
|
850
|
+
@router.get("/annotations/", response_model=list[AnnotationTable])
|
|
851
|
+
def read_annotations(
|
|
852
|
+
skip: int = Query(0, ge=0),
|
|
853
|
+
limit: int = Query(1000, ge=1, le=1000),
|
|
854
|
+
db: sa_orm.Session = Depends(make_session),
|
|
855
|
+
) -> list[AnnotationTable]:
|
|
856
|
+
with database_transaction(db, redirect=exception_redirect):
|
|
857
|
+
return db_read_sequence_models(db, AnnotationTable, skip, limit)
|
|
858
|
+
|
|
859
|
+
|
|
860
|
+
@router.put("/annotation/{sqn}", response_model=AnnotationTable)
|
|
861
|
+
def update_annotation(
|
|
862
|
+
sqn: int,
|
|
863
|
+
annotation: Annotation,
|
|
864
|
+
updated_at: datetime.datetime = Query(default_factory=dt_utc_now),
|
|
865
|
+
db: sa_orm.Session = Depends(make_session),
|
|
866
|
+
) -> AnnotationTable:
|
|
867
|
+
with database_transaction(db, redirect=exception_redirect):
|
|
868
|
+
return db_update_changing_model(db, AnnotationTable, annotation, sqn, updated_at)
|
|
869
|
+
|
|
870
|
+
|
|
871
|
+
@router.delete("/annotation/{sqn}", response_model=AnnotationTable)
|
|
872
|
+
def delete_annotation(sqn: int, db: sa_orm.Session = Depends(make_session)) -> AnnotationTable:
|
|
873
|
+
with database_transaction(db, redirect=exception_redirect):
|
|
874
|
+
return db_delete_sequence_model(db, AnnotationTable, sqn)
|
|
875
|
+
|
|
876
|
+
|
|
877
|
+
@router.post("/tagset/", response_model=TagsetTable)
|
|
878
|
+
def create_tagset(
|
|
879
|
+
tagset: Tagset,
|
|
880
|
+
created_at: datetime.datetime = Query(default_factory=dt_utc_now),
|
|
881
|
+
db: sa_orm.Session = Depends(make_session),
|
|
882
|
+
) -> TagsetTable:
|
|
883
|
+
with database_transaction(db, redirect=exception_redirect):
|
|
884
|
+
return db_create_changing_model(db, TagsetTable, tagset, created_at)
|
|
885
|
+
|
|
886
|
+
|
|
887
|
+
@router.post("/tagsets/", response_model=list[TagsetTable])
|
|
888
|
+
def create_tagsets(
|
|
889
|
+
tagsets: list[Tagset],
|
|
890
|
+
created_at: datetime.datetime = Query(default_factory=dt_utc_now),
|
|
891
|
+
db: sa_orm.Session = Depends(make_session),
|
|
892
|
+
) -> list[TagsetTable]:
|
|
893
|
+
with database_transaction(db, redirect=exception_redirect):
|
|
894
|
+
return db_create_changing_models(db, TagsetTable, tagsets, created_at)
|
|
895
|
+
|
|
896
|
+
|
|
897
|
+
@router.get("/tagset/{sqn}", response_model=TagsetTable)
|
|
898
|
+
def read_tagset(sqn: int, db: sa_orm.Session = Depends(make_session)) -> TagsetTable:
|
|
899
|
+
with database_transaction(db, redirect=exception_redirect):
|
|
900
|
+
return db_read_sequence_model(db, TagsetTable, sqn)
|
|
901
|
+
|
|
902
|
+
|
|
903
|
+
@router.get("/tagsets/", response_model=list[TagsetTable])
|
|
904
|
+
def read_tagsets(
|
|
905
|
+
skip: int = Query(0, ge=0),
|
|
906
|
+
limit: int = Query(1000, ge=1, le=1000),
|
|
907
|
+
db: sa_orm.Session = Depends(make_session),
|
|
908
|
+
) -> list[TagsetTable]:
|
|
909
|
+
with database_transaction(db, redirect=exception_redirect):
|
|
910
|
+
return db_read_sequence_models(db, TagsetTable, skip, limit)
|
|
911
|
+
|
|
912
|
+
|
|
913
|
+
@router.put("/tagset/{sqn}", response_model=TagsetTable)
|
|
914
|
+
def update_tagset(
|
|
915
|
+
sqn: int,
|
|
916
|
+
tagset: Tagset,
|
|
917
|
+
updated_at: datetime.datetime = Query(default_factory=dt_utc_now),
|
|
918
|
+
db: sa_orm.Session = Depends(make_session),
|
|
919
|
+
) -> TagsetTable:
|
|
920
|
+
with database_transaction(db, redirect=exception_redirect):
|
|
921
|
+
return db_update_changing_model(db, TagsetTable, tagset, sqn, updated_at)
|
|
922
|
+
|
|
923
|
+
|
|
924
|
+
@router.delete("/tagset/{sqn}", response_model=TagsetTable)
|
|
925
|
+
def delete_tagset(sqn: int, db: sa_orm.Session = Depends(make_session)) -> TagsetTable:
|
|
926
|
+
with database_transaction(db, redirect=exception_redirect):
|
|
927
|
+
return db_delete_sequence_model(db, TagsetTable, sqn)
|
|
928
|
+
|
|
929
|
+
|
|
930
|
+
@router.post("/tag/", response_model=TagTable)
|
|
931
|
+
def create_tag(
|
|
932
|
+
tag: Tag,
|
|
933
|
+
created_at: datetime.datetime = Query(default_factory=dt_utc_now),
|
|
934
|
+
db: sa_orm.Session = Depends(make_session),
|
|
935
|
+
) -> TagTable:
|
|
936
|
+
with database_transaction(db, redirect=exception_redirect):
|
|
937
|
+
return db_create_changing_model(db, TagTable, tag, created_at)
|
|
938
|
+
|
|
939
|
+
|
|
940
|
+
@router.post("/tags/", response_model=list[TagTable])
|
|
941
|
+
def create_tags(
|
|
942
|
+
tags: list[Tag],
|
|
943
|
+
created_at: datetime.datetime = Query(default_factory=dt_utc_now),
|
|
944
|
+
db: sa_orm.Session = Depends(make_session),
|
|
945
|
+
) -> list[TagTable]:
|
|
946
|
+
with database_transaction(db, redirect=exception_redirect):
|
|
947
|
+
return db_create_changing_models(db, TagTable, tags, created_at)
|
|
948
|
+
|
|
949
|
+
|
|
950
|
+
@router.get("/tag/{sqn}", response_model=TagTable)
|
|
951
|
+
def read_tag(sqn: int, db: sa_orm.Session = Depends(make_session)) -> TagTable:
|
|
952
|
+
with database_transaction(db, redirect=exception_redirect):
|
|
953
|
+
return db_read_sequence_model(db, TagTable, sqn)
|
|
954
|
+
|
|
955
|
+
|
|
956
|
+
@router.get("/tags/", response_model=list[TagTable])
|
|
957
|
+
def read_tags(
|
|
958
|
+
skip: int = Query(0, ge=0),
|
|
959
|
+
limit: int = Query(1000, ge=1, le=1000),
|
|
960
|
+
db: sa_orm.Session = Depends(make_session),
|
|
961
|
+
) -> list[TagTable]:
|
|
962
|
+
with database_transaction(db, redirect=exception_redirect):
|
|
963
|
+
return db_read_sequence_models(db, TagTable, skip, limit)
|
|
964
|
+
|
|
965
|
+
|
|
966
|
+
@router.put("/tag/{sqn}", response_model=TagTable)
|
|
967
|
+
def update_tag(
|
|
968
|
+
sqn: int,
|
|
969
|
+
tag: Tag,
|
|
970
|
+
updated_at: datetime.datetime = Query(default_factory=dt_utc_now),
|
|
971
|
+
db: sa_orm.Session = Depends(make_session),
|
|
972
|
+
) -> TagTable:
|
|
973
|
+
with database_transaction(db, redirect=exception_redirect):
|
|
974
|
+
return db_update_changing_model(db, TagTable, tag, sqn, updated_at)
|
|
975
|
+
|
|
976
|
+
|
|
977
|
+
@router.delete("/tag/{sqn}", response_model=TagTable)
|
|
978
|
+
def delete_tag(sqn: int, db: sa_orm.Session = Depends(make_session)) -> TagTable:
|
|
979
|
+
with database_transaction(db, redirect=exception_redirect):
|
|
980
|
+
return db_delete_sequence_model(db, TagTable, sqn)
|