Skip to content

bugfix: pipeline without computational service is not created in comp_tasks table #2105

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,6 @@ async def create_computation(
detail=f"Project {job.project_id} is not a valid directed acyclic graph!",
)

if not dag_graph.nodes():
# there is nothing else to be run here, so we are done
raise HTTPException(
status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,
detail=f"Project {job.project_id} has no computational services",
)

# ok so put the tasks in the db
await computation_pipelines.upsert_pipeline(
project.uuid, dag_graph, job.start_pipeline
Expand All @@ -150,6 +143,12 @@ async def create_computation(
)

if job.start_pipeline:
if not dag_graph.nodes():
# there is nothing else to be run here, so we are done
raise HTTPException(
status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,
detail=f"Project {job.project_id} has no computational services",
)
# trigger celery
task = celery_client.send_computation_task(job.user_id, job.project_id)
background_tasks.add_task(background_on_message, task)
Expand Down
44 changes: 44 additions & 0 deletions services/director-v2/tests/integration/test_computation_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -587,3 +587,47 @@ def test_update_and_delete_computation(
assert (
response.status_code == status.HTTP_204_NO_CONTENT
), f"response code is {response.status_code}, error: {response.text}"


def test_pipeline_with_no_comp_services_still_create_correct_comp_tasks(
client: TestClient,
user_id: PositiveInt,
project: Callable,
jupyter_service: Dict[str, str],
):
# create a workbench with just a dynamic service
project_with_dynamic_node = project(
workbench={
"39e92f80-9286-5612-85d1-639fa47ec57d": {
"key": jupyter_service["image"]["name"],
"version": jupyter_service["image"]["tag"],
"label": "my sole dynamic service",
}
}
)

# this pipeline is not runnable as there are no computational services
response = client.post(
COMPUTATION_URL,
json={
"user_id": user_id,
"project_id": str(project_with_dynamic_node.uuid),
"start_pipeline": True,
},
)
assert (
response.status_code == status.HTTP_422_UNPROCESSABLE_ENTITY
), f"response code is {response.status_code}, error: {response.text}"

# still this pipeline shall be createable if we do not want to start it
response = client.post(
COMPUTATION_URL,
json={
"user_id": user_id,
"project_id": str(project_with_dynamic_node.uuid),
"start_pipeline": False,
},
)
assert (
response.status_code == status.HTTP_201_CREATED
), f"response code is {response.status_code}, error: {response.text}"