Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
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 .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:

- name: run docker compose
run: |
docker compose up -d --build
docker compose --profile all up -d --build

- name: run docker compose dts
run: |
Expand Down
21 changes: 19 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,25 @@ standard and distributing `TES` tasks execution to `Pulsar` applications.

### Deploy
The most straightforward way to deploy the TESP is to use Docker Compose.

#### All services (default):
```
docker compose --profile all up -d
Copy link
Collaborator

@BorisYourich BorisYourich Jul 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix the readme, no longer applies

```
docker compose up -d --build

#### Without pulsar_rest service:
```
docker compose --profile api up -d
```

#### Only pulsar_rest service:
```
docker compose --profile pulsar up -d
```
<br />
<br />
<br />

Depending on you Docker and Docker Compose installation, you may need to use `docker-compose` (with hyphen) instead.

You might encounter a timeout error in container runtime which can be solved by correct `mtu` configuration either in the `docker-compose.yaml`:
Expand Down Expand Up @@ -180,7 +196,8 @@ Service representing `TESP API` is configured to mount this project sources as a
same command as is mentioned above. Therefore, any changes made to the sources in this repository will be immediately applied to the docker
service as well, enabling live reloading which makes development within the `docker` environment very easy.
```shell
docker-compose up -d
docker compose --profile all up -d

```

&nbsp;
Expand Down
3 changes: 3 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ services:
dockerfile: docker/tesp_api/Dockerfile
target: development
image: tesp-api
profiles: ["api", "all"]
environment:
- CONTAINER_TYPE=docker # Set to "docker", "singularity", or "both"
container_name: tesp-api
Expand All @@ -21,6 +22,7 @@ services:

tesp-db:
image: mongo:latest
profiles: ["api", "all"]
container_name: tesp-db
volumes:
- ./docker/mongodb/data:/data/db
Expand All @@ -39,6 +41,7 @@ services:
dockerfile: Dockerfile
target: development
image: pulsar_rest
profiles: ["pulsar", "all"]
container_name: pulsar-rest
privileged: true
expose:
Expand Down
19 changes: 14 additions & 5 deletions tesp_api/api/endpoints/task_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
from pymonad.promise import Promise
from fastapi.params import Depends
from fastapi import APIRouter, Body
from fastapi.responses import Response
# MODIFIED: Import JSONResponse
Copy link
Member

@martenson martenson May 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please drop all LLM descriptive comments and guides, instead you can include include short inline documentation and comments where you deem necessary and longer descriptions in docs for methods and classes

from fastapi.responses import Response, JSONResponse

from tesp_api.api.error import api_handle_error
from tesp_api.service.event_dispatcher import dispatch_event
Expand Down Expand Up @@ -101,25 +102,33 @@ async def get_tasks(


@router.post("/tasks/{id}:cancel",
responses={200: {"description": "Ok"}},
responses={200: {"description": "Ok"}}, # Consider adding a response_model if GA4GH TES spec defines one for cancel
description=descriptions["tasks-delete"],)
async def cancel_task(
id: str,
token_subject: str = Depends(parse_verify_token),
) -> Response:
) -> Response: # Return type is still Response, JSONResponse is a subclass
return await Promise(lambda resolve, reject: resolve((
maybe_of(token_subject),
ObjectId(id)
))).then(lambda get_tasks_args: task_repository.cancel_task(*get_tasks_args))\
.map(lambda task_id: Response(status_code=200, media_type="application/json"))\
.map(lambda task_id_maybe:
# MODIFIED: Use JSONResponse to ensure the body is "{}"
# task_id_maybe here is likely a Maybe[ObjectId] or similar from cancel_task
# We just need to return an empty JSON object on success.
# If cancel_task itself can fail and we want to return a different status,
# that logic would need to be built into how cancel_task's result is handled.
# Assuming cancel_task raises an exception handled by .catch(api_handle_error) on failure.
JSONResponse(content={}, status_code=200)
)\
.catch(api_handle_error)


@router.get("/service-info",
responses={200: {"description": "Ok"}},
description=descriptions["service-info"],
response_model=TesServiceInfo)
async def get_service_info() -> TesServiceInfo:
async def get_service_info() -> TesServiceInfo: # FastAPI directly handles Pydantic model return
return TesServiceInfo(
id="fi.muni.cz.tesp",
name="TESP",
Expand Down
Loading
Loading