示例#1
0
文件: projects.py 项目: adiso75/mlrun
def patch_project(
        project: dict,
        name: str,
        patch_mode: schemas.PatchMode = fastapi.Header(
            schemas.PatchMode.replace, alias=schemas.HeaderNames.patch_mode),
        projects_role: typing.Optional[schemas.ProjectsRole] = fastapi.Header(
            None, alias=schemas.HeaderNames.projects_role),
        # TODO: we're in a http request context here, therefore it doesn't make sense that by default it will hold the
        #  request until the process will be completed - after UI supports waiting - change default to False
        wait_for_completion: bool = fastapi.Query(True,
                                                  alias="wait-for-completion"),
        iguazio_session: typing.Optional[str] = fastapi.Cookie(
            None, alias="session"),
        db_session: Session = fastapi.Depends(deps.get_db_session),
):
    project, is_running_in_background = get_project_member().patch_project(
        db_session,
        name,
        project,
        patch_mode,
        projects_role,
        iguazio_session,
        wait_for_completion=wait_for_completion,
    )
    if is_running_in_background:
        return fastapi.Response(status_code=HTTPStatus.ACCEPTED.value)
    return project
示例#2
0
def get_frontend_spec(session: typing.Optional[str] = fastapi.Cookie(None)):
    jobs_dashboard_url = None
    if session:
        jobs_dashboard_url = _resolve_jobs_dashboard_url(session)
    return mlrun.api.schemas.FrontendSpec(
        jobs_dashboard_url=jobs_dashboard_url,
        abortable_function_kinds=mlrun.runtimes.RuntimeKinds.
        abortable_runtimes(),
    )
示例#3
0
def get_frontend_spec(
    auth_info: mlrun.api.schemas.AuthInfo = fastapi.Depends(
        mlrun.api.api.deps.authenticate_request),
    # In Iguazio 3.0 auth is turned off, but for this endpoint specifically the session is a must, so getting it from
    # the cookie like it was before
    # TODO: remove when Iguazio 3.0 is no longer relevant
    session: typing.Optional[str] = fastapi.Cookie(None),
):
    jobs_dashboard_url = None
    session = auth_info.session or session
    if session:
        jobs_dashboard_url = _resolve_jobs_dashboard_url(session)
    feature_flags = _resolve_feature_flags()
    registry, repository = mlrun.utils.helpers.get_parsed_docker_registry()
    repository = mlrun.utils.helpers.get_docker_repository_or_default(
        repository)
    function_deployment_target_image_template = mlrun.runtimes.utils.fill_function_image_name_template(
        f"{registry}/",
        repository,
        "{project}",
        "{name}",
        "{tag}",
    )
    return mlrun.api.schemas.FrontendSpec(
        jobs_dashboard_url=jobs_dashboard_url,
        abortable_function_kinds=mlrun.runtimes.RuntimeKinds.
        abortable_runtimes(),
        feature_flags=feature_flags,
        default_function_priority_class_name=config.
        default_function_priority_class_name,
        valid_function_priority_class_names=config.
        get_valid_function_priority_class_names(),
        default_function_image_by_kind=mlrun.mlconf.function_defaults.
        image_by_kind.to_dict(),
        function_deployment_target_image_template=
        function_deployment_target_image_template,
        function_deployment_mlrun_command=mlrun.builder.
        resolve_mlrun_install_command(),
        auto_mount_type=config.storage.auto_mount_type,
        auto_mount_params=config.get_storage_auto_mount_params(),
    )
示例#4
0
def get_frontend_spec(session: typing.Optional[str] = fastapi.Cookie(None)):
    jobs_dashboard_url = None
    if session:
        jobs_dashboard_url = _resolve_jobs_dashboard_url(session)
    return mlrun.api.schemas.FrontendSpec(
        jobs_dashboard_url=jobs_dashboard_url)