From 09c626da00c8d99fa7b171fdaac0b40d334d10ee Mon Sep 17 00:00:00 2001 From: Nicolas Homberg Date: Sun, 24 Nov 2024 17:35:38 +0100 Subject: [PATCH] Update example_submission.py While I was trying to use the robot submission, I had to add the file_size in the payload in order to achieve a robot submission --- docs/example_scripts/example_submission.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/example_scripts/example_submission.py b/docs/example_scripts/example_submission.py index 6f48c36a9..337a4d2ce 100755 --- a/docs/example_scripts/example_submission.py +++ b/docs/example_scripts/example_submission.py @@ -41,7 +41,7 @@ # ---------------------------------------------------------------------------- from urllib.parse import urljoin # noqa: E402 import requests # noqa: E402,E261 # Ignore E261 to line up these noqa - +import os # Check someone updated PHASE_ID argument! assert PHASE_ID, "PHASE_ID must be set at the top of this script" @@ -68,11 +68,16 @@ print(f"Failed to create submission: {resp.json()['reason']}") exit(-2) + + +file_size = os.path.getsize(SUBMISSION_ZIP_PATH) + # Create + Upload our dataset datasets_url = urljoin(CODALAB_URL, '/api/datasets/') datasets_payload = { "type": "submission", "request_sassy_file_name": "submission.zip", + "file_size": file_size, } resp = requests.post(datasets_url, datasets_payload, headers=headers) if resp.status_code != 201: