Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ RUN apt-get update \

# Copy and install the transfer library wheel
COPY --from=transfer-builder /transfer-build/dist/*.whl /api/dist/
RUN pip install --no-cache-dir /api/dist/pontoon-*.whl
RUN pip install --only-binary=:all: --no-cache-dir /api/dist/pontoon-*.whl

# Build the API app
COPY ./api/pyproject.toml /api/pyproject.toml
Expand Down
6 changes: 5 additions & 1 deletion api/app/models/transfer_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,11 @@ def get_latest_transfer_run(session, transfer_id:uuid.UUID, status:str = None) -
if status != None:
stmt = stmt.where(TransferRun.Model.status == status)

return session.exec(stmt).first()
result = session.exec(stmt).all()
if len(result) == 1:
return result[0]
else:
return None


@staticmethod
Expand Down
11 changes: 9 additions & 2 deletions api/app/routers/internal.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import uuid
from typing import Optional
from fastapi import HTTPException, Depends, Query, APIRouter

from app.dependencies import get_session
Expand Down Expand Up @@ -36,7 +37,7 @@ def read_destination(destination_id: uuid.UUID, session=Depends(get_session)):
return get_destination_by_id(session, destination_id)


@router.get("/runs/{transfer_id}", response_model=TransferRun.Model)
@router.get("/runs/{transfer_id}", response_model=Optional[TransferRun.Model])
def get_transfer_run(transfer_id: uuid.UUID, session=Depends(get_session)):
return TransferRun.get_latest_transfer_run(session, transfer_id)

Expand All @@ -62,7 +63,13 @@ def update_transfer_run(transfer_run_id:uuid.UUID, transfer_run:TransferRun.Upda

# Get the destination vendor type
transfer_id = transfer_run.transfer_id
destination_id = Transfer.get(session, transfer_id).destination_id
transfer = Transfer.get(session, transfer_id)

# Ad-hoc transfer runs don't have a parent transfer
if transfer is None:
return transfer_run

destination_id = transfer.destination_id
destination_vendor_type = Destination.get(session, destination_id).connection_info['vendor_type']

# Get the source vendor types from the models transferred
Expand Down
2 changes: 1 addition & 1 deletion data-transfer/pontoon/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ RUN apt-get update \
COPY pyproject.toml ./pyproject.toml

# Install the pontoon package and its dependencies
RUN pip install --no-cache-dir .
RUN pip install --only-binary=:all: --no-cache-dir .

# Copy the pontoon source code
COPY pontoon/ ./pontoon/
1 change: 1 addition & 0 deletions data-transfer/pontoon/pontoon/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from pontoon.base import Progress
from pontoon.cache.memory_cache import MemoryCache
from pontoon.cache.sqlite_cache import SqliteCache
from pontoon.cache.arrow_ipc_cache import ArrowIpcCache
from pontoon.base import Namespace, Stream, Record, Dataset, Cache, Mode, Source, Destination
from pontoon.base import SourceConnectionFailed, SourceStreamDoesNotExist, SourceStreamInvalidSchema
from pontoon.base import DestinationConnectionFailed, DestinationStreamInvalidSchema
Expand Down
2 changes: 1 addition & 1 deletion data-transfer/pontoon/pontoon/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def with_batch_id(self, batch_id:str, field_name:str='pontoon__batch_id') -> 'St


def with_last_synced_at(self, sync_dt:datetime, field_name:str='pontoon__last_synced_at') -> 'Stream':
return self.with_field(field_name, pa.timestamp('us', tz='UTC'), sync_dt.isoformat())
return self.with_field(field_name, pa.timestamp('us', tz='UTC'), sync_dt)


def with_version(self, version:str, field_name='pontoon__version') -> 'Stream':
Expand Down
Loading