Skip to content
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

V1 fix entrypoint schema #613

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
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: 2 additions & 0 deletions src/dioptra/restapi/v1/entrypoints/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,10 @@ class EntrypointMutableFieldsSchema(Schema):
fields.Integer(),
attribute="queue_ids",
data_key="queues",
allow_none=True,
metadata=dict(description="The queue for the entrypoint."),
load_only=True,
load_default=list(),
)


Expand Down
6 changes: 4 additions & 2 deletions tests/unit/restapi/lib/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def register_entrypoint(
task_graph: str,
parameters: list[dict[str, Any]],
plugin_ids: list[int],
queue_ids: list[int],
queue_ids: list[int] | None = None,
) -> TestResponse:
"""Register an entrypoint using the API.

Expand All @@ -87,9 +87,11 @@ def register_entrypoint(
"taskGraph": task_graph,
"parameters": parameters,
"plugins": plugin_ids,
"queues": queue_ids,
}

if queue_ids:
payload["queues"] = queue_ids

if description:
payload["description"] = description

Expand Down
15 changes: 15 additions & 0 deletions tests/unit/restapi/v1/test_entrypoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,21 @@ def test_create_entrypoint(
queue_ids=queue_ids,
)

# Testing that queue_ids feild can be excluded
entrypoint_response = actions.register_entrypoint(
client,
name="queues_not_included",
description=description,
group_id=group_id,
task_graph=task_graph,
parameters=parameters,
plugin_ids=plugin_ids,
)
entrypoint_expected = entrypoint_response.get_json()
assert_retrieving_entrypoint_by_id_works(
client, entrypoint_id=entrypoint_expected["id"], expected=entrypoint_expected
)


def test_entrypoint_get_all(
client: FlaskClient,
Expand Down
Loading