From 10a36af9c556c4f52cb06b877668bd2c3eaef7d2 Mon Sep 17 00:00:00 2001 From: rikunosuke Date: Mon, 15 Jun 2026 18:16:39 +0900 Subject: [PATCH 1/5] =?UTF-8?q?Robotics=20Pipline=20endoint=20=E3=81=AE?= =?UTF-8?q?=E3=83=AD=E3=82=B8=E3=83=83=E3=82=AF=E3=81=AE=E4=BD=9C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fastlabel/__init__.py | 48 +++++++++++++++++++++++++++++++++++++++++++ fastlabel/api.py | 2 +- 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/fastlabel/__init__.py b/fastlabel/__init__.py index 0155359..d3c0fea 100644 --- a/fastlabel/__init__.py +++ b/fastlabel/__init__.py @@ -2451,6 +2451,54 @@ def import_robotics_contents_file( return self.api.post_request(endpoint, payload=payload) + def import_robotics_mcap(self, project: str, task_id: str, file_path: str) -> dict: + """ + Import robotics mcap zip file. + project is slug of your project (Required). + task_id is a id of the robotics task to import contents (Required). + file_path is a path to data. Supported extensions are zip (Required). + """ + if not file_path.endswith(".zip"): + raise FastLabelInvalidException( + "Supported extensions are zip (Required).", 422 + ) + history_id = self._start_pipeline(project=project, task_id=task_id) + self._upload_zip_with_signed_url( + history_id=history_id, + file_path=file_path, + ) + return self._trigger_batch_import(history_id=history_id) + + def _start_pipeline( + self, + project: str, + task_id: str, + ) -> str: + history: dict = self.api.post_request( + "data-lake/import-pipeline/start", + payload={ + "project": project, + "taskId": task_id, + }, + ) + logger.info(f"Started data lake pipeline with history ID: {history['id']}") + return history["id"] + + def _upload_zip_with_signed_url(self, history_id: str, file_path: str) -> None: + url = self.api.get_request( + "data-lake/import-pipeline/signed-url", params={"historyId": history_id} + ) + res = self.api.upload_zipfile(url=url, file_path=file_path) + res.raise_for_status() + + def _trigger_batch_import(self, history_id: str) -> dict: + return self.api.post_request( + "data-lake/import-pipeline/run", + payload={ + "historyId": history_id, + }, + ) + # Task Update def update_task( diff --git a/fastlabel/api.py b/fastlabel/api.py index 20e5188..b25dbb2 100644 --- a/fastlabel/api.py +++ b/fastlabel/api.py @@ -19,7 +19,7 @@ def __init__(self, access_token: Optional[str] = None): raise ValueError("FASTLABEL_ACCESS_TOKEN is not configured.") self.access_token = "Bearer " + access_token - def get_request(self, endpoint: str, params=None) -> Union[dict, list]: + def get_request(self, endpoint: str, params=None) -> Union[dict, list, str]: """Makes a get request to an endpoint. If an error occurs, assumes that endpoint returns JSON as: { 'statusCode': XXX, From 37f5175b9b7c83481a65a60c63cda85faae87194 Mon Sep 17 00:00:00 2001 From: rikunosuke Date: Thu, 18 Jun 2026 09:37:41 +0900 Subject: [PATCH 2/5] =?UTF-8?q?fix:=20robotics=20import-pipeline=20?= =?UTF-8?q?=E3=82=A8=E3=83=B3=E3=83=89=E3=83=9D=E3=82=A4=E3=83=B3=E3=83=88?= =?UTF-8?q?=E3=81=A8=20signed-url=20=E3=83=AC=E3=82=B9=E3=83=9D=E3=83=B3?= =?UTF-8?q?=E3=82=B9=E5=AF=BE=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - import-pipeline 系エンドポイントを data-lake/robotics/ 配下に変更 - signed-url レスポンスを dict 形式 (url キー) に対応 Co-Authored-By: Claude Opus 4.8 (1M context) --- fastlabel/__init__.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/fastlabel/__init__.py b/fastlabel/__init__.py index d3c0fea..8969895 100644 --- a/fastlabel/__init__.py +++ b/fastlabel/__init__.py @@ -2475,7 +2475,7 @@ def _start_pipeline( task_id: str, ) -> str: history: dict = self.api.post_request( - "data-lake/import-pipeline/start", + "data-lake/robotics/import-pipeline/start", payload={ "project": project, "taskId": task_id, @@ -2485,15 +2485,16 @@ def _start_pipeline( return history["id"] def _upload_zip_with_signed_url(self, history_id: str, file_path: str) -> None: - url = self.api.get_request( - "data-lake/import-pipeline/signed-url", params={"historyId": history_id} + signed_url_data = self.api.get_request( + "data-lake/robotics/import-pipeline/signed-url", + params={"historyId": history_id}, ) - res = self.api.upload_zipfile(url=url, file_path=file_path) + res = self.api.upload_zipfile(url=signed_url_data["url"], file_path=file_path) res.raise_for_status() def _trigger_batch_import(self, history_id: str) -> dict: return self.api.post_request( - "data-lake/import-pipeline/run", + "data-lake/robotics/import-pipeline/run", payload={ "historyId": history_id, }, From 4bf8f5bd760350242ecb956d23c5f4a573333764 Mon Sep 17 00:00:00 2001 From: rikunosuke Date: Thu, 18 Jun 2026 09:49:05 +0900 Subject: [PATCH 3/5] =?UTF-8?q?docs:=20import=5Frobotics=5Fmcap=20?= =?UTF-8?q?=E3=81=AE=20README=20=E3=81=A8=20example=20=E3=82=92=E8=BF=BD?= =?UTF-8?q?=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.8 (1M context) --- README.md | 14 ++++++++++++++ examples/import_robotics_mcap.py | 19 +++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 examples/import_robotics_mcap.py diff --git a/README.md b/README.md index 4625b2c..e8dc1e3 100644 --- a/README.md +++ b/README.md @@ -2230,6 +2230,20 @@ history = client.import_robotics_contents_file( ) ``` +#### Import mcap + +Import an mcap zip file into an existing robotics task. + +This method starts an import pipeline, uploads the zip file via a signed URL, and triggers the batch import. + +```python +result = client.import_robotics_mcap( + project="YOUR_PROJECT_SLUG", + task_id="YOUR_TASK_ID", + file_path="ZIP_FILE_PATH", # Supported extension is .zip +) +``` + #### Import LeRobot Dataset Import a [LeRobot](https://github.com/huggingface/lerobot) dataset (v3) into a FastLabel robotics project. diff --git a/examples/import_robotics_mcap.py b/examples/import_robotics_mcap.py new file mode 100644 index 0000000..f185be0 --- /dev/null +++ b/examples/import_robotics_mcap.py @@ -0,0 +1,19 @@ +""" +Import an mcap zip file into an existing FastLabel robotics task. + +This starts an import pipeline, uploads the zip via a signed URL, +and triggers the batch import. +""" + +from pprint import pprint + +import fastlabel + +client = fastlabel.Client() + +result = client.import_robotics_mcap( + project="YOUR_PROJECT_SLUG", + task_id="YOUR_TASK_ID", + file_path="ZIP_FILE_PATH", # Supported extension is .zip +) +pprint(result) From b7907455aaa8058fcd24625c5c98d590f24930f1 Mon Sep 17 00:00:00 2001 From: rikunosuke Date: Thu, 18 Jun 2026 09:56:09 +0900 Subject: [PATCH 4/5] =?UTF-8?q?fix:=20get=5Frequest=20=E3=81=AE=E6=88=BB?= =?UTF-8?q?=E3=82=8A=E5=80=A4=E5=9E=8B=E3=81=8B=E3=82=89=E4=B8=8D=E8=A6=81?= =?UTF-8?q?=E3=81=AA=20str=20=E3=82=92=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit signed-url レスポンスを dict で扱うよう変更したため、str は不要 Co-Authored-By: Claude Opus 4.8 (1M context) --- fastlabel/api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fastlabel/api.py b/fastlabel/api.py index b25dbb2..20e5188 100644 --- a/fastlabel/api.py +++ b/fastlabel/api.py @@ -19,7 +19,7 @@ def __init__(self, access_token: Optional[str] = None): raise ValueError("FASTLABEL_ACCESS_TOKEN is not configured.") self.access_token = "Bearer " + access_token - def get_request(self, endpoint: str, params=None) -> Union[dict, list, str]: + def get_request(self, endpoint: str, params=None) -> Union[dict, list]: """Makes a get request to an endpoint. If an error occurs, assumes that endpoint returns JSON as: { 'statusCode': XXX, From d446c4d70e038f0a2068421cc375aeded3284210 Mon Sep 17 00:00:00 2001 From: rikunosuke Date: Mon, 22 Jun 2026 14:54:05 +0900 Subject: [PATCH 5/5] =?UTF-8?q?docs:=20import=5Frobotics=5Fmcap=20?= =?UTF-8?q?=E3=81=8C=E9=9D=9E=E5=90=8C=E6=9C=9F=E3=81=A7=E3=81=82=E3=82=8B?= =?UTF-8?q?=E3=81=93=E3=81=A8=E3=81=A8=E9=80=B2=E6=8D=97=E7=A2=BA=E8=AA=8D?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E3=82=92=E6=98=8E=E8=A8=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 内部実装の signed URL / pipeline の記述を削除し、処理が非同期である ことと import 履歴画面で状態を確認する旨を追記 Co-Authored-By: Claude Opus 4.8 (1M context) --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e8dc1e3..ea5679e 100644 --- a/README.md +++ b/README.md @@ -2234,7 +2234,7 @@ history = client.import_robotics_contents_file( Import an mcap zip file into an existing robotics task. -This method starts an import pipeline, uploads the zip file via a signed URL, and triggers the batch import. +This method uploads the zip file and starts the import. The import runs **asynchronously** on the server, so the call returns as soon as the import is accepted — it does **not** wait for the import to finish. ```python result = client.import_robotics_mcap( @@ -2244,6 +2244,8 @@ result = client.import_robotics_mcap( ) ``` +There is no API to poll the import progress. Check the import status (and any errors) on the import history screen (`/imports`) in the FastLabel application. + #### Import LeRobot Dataset Import a [LeRobot](https://github.com/huggingface/lerobot) dataset (v3) into a FastLabel robotics project.