From 3e600295355bdac4c89a2392681fb3cd72029740 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Luijmes?= Date: Thu, 25 Nov 2021 09:31:35 +0100 Subject: [PATCH 1/2] feat: configurable artifact max payload size --- src/prefect_server/config.toml | 3 +++ src/prefect_server/graphql/artifacts.py | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/prefect_server/config.toml b/src/prefect_server/config.toml index c2bbd752..027c7e69 100644 --- a/src/prefect_server/config.toml +++ b/src/prefect_server/config.toml @@ -20,6 +20,9 @@ insert_many_batch_size = 200 # path for user configuration file user_config_path = "~/.prefect_server/config.toml" +# maximum amount of bytes artifact accepts, defaults to 1 mb. +artifacts_max_payload_bytes = 1000000 + [api] url = 'http://localhost:4200' diff --git a/src/prefect_server/graphql/artifacts.py b/src/prefect_server/graphql/artifacts.py index 0399d19c..3b5da085 100644 --- a/src/prefect_server/graphql/artifacts.py +++ b/src/prefect_server/graphql/artifacts.py @@ -6,6 +6,7 @@ from graphql import GraphQLResolveInfo from prefect import api +from prefect_server import config from prefect_server.utilities.graphql import mutation @@ -17,8 +18,10 @@ async def resolve_create_task_run_artifact( data = input.get("data") data_size = sys.getsizeof(json.dumps(data)) - if data_size > 1000000: # 1 mb max - raise ValueError("Artifact data payload exceedes 1Mb limit.") + if data_size > config.artifacts_max_payload_bytes: + raise ValueError( + f"Artifact data payload exceeds {config.artifacts_max_payload_bytes} bytes limit." + ) task_run_artifact_id = await api.artifacts.create_task_run_artifact( task_run_id=input.get("task_run_id"), From 92a8993d048465d13ee983f9f91c074c5fc89daa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Luijmes?= Date: Thu, 25 Nov 2021 09:36:24 +0100 Subject: [PATCH 2/2] chore: add changelog --- changes/pr320.yaml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 changes/pr320.yaml diff --git a/changes/pr320.yaml b/changes/pr320.yaml new file mode 100644 index 00000000..a42060ae --- /dev/null +++ b/changes/pr320.yaml @@ -0,0 +1,23 @@ +# An example changelog entry +# +# 1. Choose one (or more if a PR encompasses multiple changes) of the following headers: +# - feature +# - enhancement +# - fix +# - deprecation +# - breaking (for breaking changes) +# - migration (for database migrations) +# +# 2. Fill in one (or more) bullet points under the heading, describing the change. +# Markdown syntax may be used. +# +# 3. If you would like to be credited as helping with this release, add a +# contributor section with your name and github username. +# +# Here's an example of a PR that adds an enhancement + +enhancement: + - "Configure the maximum artifact payload - [#320](https://github.com/PrefectHQ/server/pull/320)" + +contributor: + - "[Joël Luijmes](https://github.com/joelluijmes)"