Esempio n. 1
0
async def handle_patch_deployment(
        project_id: str,
        deployment_id: str,
        deployment: projects.schemas.deployment.DeploymentUpdate,
        session: Session = Depends(database.session_scope),
        kubeflow_userid: Optional[str] = Header(database.DB_TENANT),
):
    """
    Handles PATCH requests to /<deployment_id>.

    Parameters
    ----------
    project_id : str
    deployment_id : str
    session : sqlalchemy.orm.session.Session
    kubeflow_userid : fastapi.Header

    Returns
    -------
    projects.schemas.deployment.Deployment
    """
    project_controller = ProjectController(session,
                                           kubeflow_userid=kubeflow_userid)
    project_controller.raise_if_project_does_not_exist(project_id)

    deployment_controller = DeploymentController(
        session, kubeflow_userid=kubeflow_userid)
    deployment = deployment_controller.update_deployment(
        deployment_id=deployment_id,
        project_id=project_id,
        deployment=deployment)
    return deployment
Esempio n. 2
0
async def handle_patch_deployment(project_id: str,
                                  deployment_id: str,
                                  deployment: projects.schemas.deployment.DeploymentUpdate,
                                  session: Session = Depends(session_scope)):
    """
    Handles PATCH requests to /<deployment_id>.

    Parameters
    ----------
    project_id : str
    deployment_id : str
    session : sqlalchemy.orm.session.Session

    Returns
    -------
    projects.schemas.deployment.Deployment
    """
    project_controller = ProjectController(session)
    project_controller.raise_if_project_does_not_exist(project_id)

    deployment_controller = DeploymentController(session)
    deployment = deployment_controller.update_deployment(deployment_id=deployment_id,
                                                         project_id=project_id,
                                                         deployment=deployment)
    return deployment