Skip to content

Commit

Permalink
Merge branch 'master' into is7055/fix-invitation-double-slash
Browse files Browse the repository at this point in the history
  • Loading branch information
odeimaiz authored Jan 21, 2025
2 parents 90a3d29 + 8909588 commit 52a2cfb
Show file tree
Hide file tree
Showing 99 changed files with 2,695 additions and 904 deletions.
29 changes: 6 additions & 23 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ updates:
- sanderegg
assignees:
- pcrespov
- sanderegg
labels:
- t:maintenance
ignore:
- dependency-name: docker-compose
versions:
Expand All @@ -26,32 +29,10 @@ updates:
- dependency-name: httpx
versions:
- 0.17.0
- package-ecosystem: pip
directory: "/packages/service-library"
schedule:
interval: weekly
time: "04:00"
open-pull-requests-limit: 10
reviewers:
- pcrespov
- sanderegg
assignees:
- pcrespov
ignore:
- dependency-name: openapi-core
versions:
- "> 0.12.0, < 1"
- package-ecosystem: pip
directory: "/packages/postgres-database"
schedule:
interval: weekly
time: "04:00"
open-pull-requests-limit: 10
reviewers:
- pcrespov
- sanderegg
assignees:
- pcrespov

- package-ecosystem: "github-actions"
directory: "/"
schedule:
Expand All @@ -62,3 +43,5 @@ updates:
- pcrespov
assignees:
- sanderegg
labels:
- t:maintenance
2 changes: 0 additions & 2 deletions .github/workflows/ci-testing-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1730,15 +1730,13 @@ jobs:
matrix:
python: ["3.11"]
os: [ubuntu-22.04]
docker_buildx: [v0.10.4]
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: setup docker buildx
id: buildx
uses: docker/setup-buildx-action@v3
with:
version: ${{ matrix.docker_buildx }}
driver: docker-container
- name: setup python environment
uses: actions/setup-python@v5
Expand Down
21 changes: 20 additions & 1 deletion api/specs/web-server/_projects_wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,20 @@
# pylint: disable=unused-variable
# pylint: disable=too-many-arguments

from typing import Annotated

from _common import assert_handler_signature_against_model
from fastapi import APIRouter
from fastapi import APIRouter, Depends, status
from models_library.api_schemas_webserver.wallets import WalletGet
from models_library.generics import Envelope
from models_library.projects import ProjectID
from models_library.wallets import WalletID
from simcore_service_webserver._meta import API_VTAG
from simcore_service_webserver.projects._common.models import ProjectPathParams
from simcore_service_webserver.projects._wallets_handlers import (
_PayProjectDebtBody,
_ProjectWalletPathParams,
)

router = APIRouter(
prefix=f"/{API_VTAG}",
Expand Down Expand Up @@ -51,3 +56,17 @@ async def connect_wallet_to_project(


assert_handler_signature_against_model(connect_wallet_to_project, ProjectPathParams)


@router.post(
"/projects/{project_id}/wallet/{wallet_id}:pay-debt",
status_code=status.HTTP_204_NO_CONTENT,
)
async def pay_project_debt(
_path: Annotated[_ProjectWalletPathParams, Depends()],
_body: Annotated[_PayProjectDebtBody, Depends()],
):
...


assert_handler_signature_against_model(connect_wallet_to_project, ProjectPathParams)
38 changes: 36 additions & 2 deletions packages/models-library/src/models_library/resource_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,50 @@ class ServiceRunStatus(StrAutoEnum):


class CreditTransactionStatus(StrAutoEnum):
# Represents the possible statuses of a credit transaction.

PENDING = auto()
# The transaction is pending and has not yet been finalized.
# Example: During the running of a service, the transaction remains in the Pending state until the service is stopped.

BILLED = auto()
# The transaction has been successfully billed.

IN_DEBT = auto()
# The transaction is marked as in debt.
# Example: This occurs when a computational job continues to run even though the user does not have sufficient credits in their wallet.

NOT_BILLED = auto()
# The transaction will not be billed.
# Example: This status is used when there is an issue on our side, and we decide not to bill the user.

REQUIRES_MANUAL_REVIEW = auto()
# The transaction requires manual review due to potential issues.
# NOTE: This status is currently not in use.


class CreditClassification(StrAutoEnum):
ADD_WALLET_TOP_UP = auto() # user top up credits
DEDUCT_SERVICE_RUN = auto() # computational/dynamic service run costs)
# Represents the different types of credit classifications.

ADD_WALLET_TOP_UP = auto()
# Indicates that credits have been added to the user's wallet through a top-up.
# Example: The user adds funds to their wallet to increase their available credits.

DEDUCT_SERVICE_RUN = auto()
# Represents a deduction from the user's wallet due to the costs of running a computational or dynamic service.
# Example: Credits are deducted when the user runs a simulation.

DEDUCT_LICENSE_PURCHASE = auto()
# Represents a deduction from the user's wallet for purchasing a license.
# Example: The user purchases a license to access premium features such as VIP models.

ADD_WALLET_EXCHANGE = auto()
# Represents the addition of credits to the user's wallet through an exchange.
# Example: Credits are added due to credit exchange between wallets.

DEDUCT_WALLET_EXCHANGE = auto()
# Represents a deduction of credits from the user's wallet through an exchange.
# Example: Credits are deducted due to credit exchange between wallets.


class PricingPlanClassification(StrAutoEnum):
Expand Down
2 changes: 1 addition & 1 deletion packages/postgres-database/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# syntax=docker/dockerfile:1
ARG PYTHON_VERSION="3.11.9"
ARG UV_VERSION="0.4"
ARG UV_VERSION="0.5"
FROM ghcr.io/astral-sh/uv:${UV_VERSION} AS uv_build
# we docker image is built based on debian
FROM python:${PYTHON_VERSION}-slim-bookworm AS base
Expand Down
2 changes: 1 addition & 1 deletion packages/postgres-database/scripts/erd/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Define arguments in the global scope
ARG PYTHON_VERSION="3.11.9"
ARG UV_VERSION="0.4"
ARG UV_VERSION="0.5"
FROM ghcr.io/astral-sh/uv:${UV_VERSION} AS uv_build
# we docker image is built based on debian
FROM python:${PYTHON_VERSION}-slim-bookworm AS base
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
"""add credit transaction classification enums
Revision ID: a3a58471b0f1
Revises: f19905923355
Create Date: 2025-01-14 13:44:05.025647+00:00
"""
import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision = "a3a58471b0f1"
down_revision = "f19905923355"
branch_labels = None
depends_on = None


def upgrade():
op.execute(sa.DDL("ALTER TYPE credittransactionstatus ADD VALUE 'IN_DEBT'"))
op.execute(
sa.DDL(
"ALTER TYPE credittransactionclassification ADD VALUE 'ADD_WALLET_EXCHANGE'"
)
)
op.execute(
sa.DDL(
"ALTER TYPE credittransactionclassification ADD VALUE 'DEDUCT_WALLET_EXCHANGE'"
)
)


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
pass
# ### end Alembic commands ###
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
class CreditTransactionStatus(str, enum.Enum):
PENDING = "PENDING"
BILLED = "BILLED"
IN_DEBT = "IN_DEBT"
NOT_BILLED = "NOT_BILLED"
REQUIRES_MANUAL_REVIEW = "REQUIRES_MANUAL_REVIEW"

Expand All @@ -28,6 +29,8 @@ class CreditTransactionClassification(str, enum.Enum):
"DEDUCT_SERVICE_RUN" # computational/dynamic service run costs)
)
DEDUCT_LICENSE_PURCHASE = "DEDUCT_LICENSE_PURCHASE"
ADD_WALLET_EXCHANGE = "ADD_WALLET_EXCHANGE"
DEDUCT_WALLET_EXCHANGE = "DEDUCT_WALLET_EXCHANGE"


resource_tracker_credit_transactions = sa.Table(
Expand Down
2 changes: 1 addition & 1 deletion packages/service-integration/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Define arguments in the global scope
ARG PYTHON_VERSION="3.11.9"
ARG UV_VERSION="0.4"
ARG UV_VERSION="0.5"
FROM ghcr.io/astral-sh/uv:${UV_VERSION} AS uv_build
# we docker image is built based on debian
FROM python:${PYTHON_VERSION}-slim-bookworm AS base
Expand Down
80 changes: 0 additions & 80 deletions packages/service-library/src/servicelib/project_lock.py

This file was deleted.

Loading

0 comments on commit 52a2cfb

Please sign in to comment.