Skip to content

Upload sample file functionality - #123

Merged
Kostis-S-Z merged 6 commits into
mainfrom
upload-sample-file
Aug 5, 2026
Merged

Upload sample file functionality#123
Kostis-S-Z merged 6 commits into
mainfrom
upload-sample-file

Conversation

@Kostis-S-Z

Copy link
Copy Markdown
Contributor

Adds the ability upload a sample file of the dataset through the existing create_submission_with_upload function or a separate public function upload_sample_file.

Changes

  • upload.py: Single shared _upload_file(..., is_sample) function used by both upload_dataset_file and the new public upload_sample_file(file_path, submission_id, state_path, show_progress, enable_logging, part_size)sits next to it. No signature changes to the existing upload_dataset_file.

  • _upload_base_url(submission_id, is_sample) picks between /uploads and /submissions/{id}/sample endpoints. All the sub-functions: _initiate_upload, _get_presigned_part_url, and _complete_upload take is_sample as arg and build their URLs from it, so the three new endpoints reuse the exact multipart upload flow.

  • UploadState has a new field isSample: bool = False and _state_matches now rejects state from the other upload kind. Sample state files default to <filename>.mdc-sample-upload.json so sample and dataset resume state never collide.

  • create_submission_with_upload takes optional sample_file_path and sample_state_path. A missing sample path raises FileNotFoundError up front (before the draft is created or anything uploaded). Also the sample uploads after the dataset archive and before submit, so an interrupted big upload doesn't cause the sample to be re-uploaded.

  • DatasetSubmission now declares the API-set, read-only sampleFileReferenceId (it's already returned in submission payloads).

  • Added both e2e live tests and smaller unit tests

  • Updated the docs in multiple places

@moz-tello-wharton moz-tello-wharton left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sweet :))

@Kostis-S-Z
Kostis-S-Z merged commit 218a27f into main Aug 5, 2026
3 checks passed
@Kostis-S-Z
Kostis-S-Z deleted the upload-sample-file branch August 5, 2026 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants