Create a new deployment. Args: app (str): The app to create the deployment for. project_id (str): The ID of the project to create the deployment for. uri (str): The URI of the service. Returns: DeploymentDB: The created deployment.
(
app_id: str,
project_id: str,
uri: str,
)
| 534 | |
| 535 | |
| 536 | async def create_deployment( |
| 537 | app_id: str, |
| 538 | project_id: str, |
| 539 | uri: str, |
| 540 | ) -> DeploymentDB: |
| 541 | """Create a new deployment. |
| 542 | |
| 543 | Args: |
| 544 | app (str): The app to create the deployment for. |
| 545 | project_id (str): The ID of the project to create the deployment for. |
| 546 | uri (str): The URI of the service. |
| 547 | |
| 548 | Returns: |
| 549 | DeploymentDB: The created deployment. |
| 550 | """ |
| 551 | |
| 552 | async with engine.core_session() as session: |
| 553 | try: |
| 554 | deployment = DeploymentDB( |
| 555 | app_id=uuid.UUID(app_id), |
| 556 | project_id=uuid.UUID(project_id), |
| 557 | uri=uri, |
| 558 | ) |
| 559 | |
| 560 | session.add(deployment) |
| 561 | await session.commit() |
| 562 | await session.refresh(deployment) |
| 563 | |
| 564 | return deployment |
| 565 | |
| 566 | except Exception as e: |
| 567 | raise Exception(f"Error while creating deployment: {e}") |
| 568 | |
| 569 | |
| 570 | async def get_app_type_from_template_key(template_key: Optional[str]) -> Optional[str]: |
nothing calls this directly
no test coverage detected