未验证 提交 e018b10e 编写于 作者: R Roman Donchenko 提交者: GitHub

SDK: fix `Project.import_dataset` incorrectly waiting for completion (#5459)

You have to use the `import_status` action in order to query the input
status. Otherwise, the `/api/projects/{id}/dataset/` endpoint initiates
a dataset export. Currently, `import_dataset` inadvertently monitors the
status of that export, not the original import.
上级 fa92ccb9
......@@ -103,6 +103,8 @@ non-ascii paths while adding files from "Connected file share" (issue #4428)
- Missing source tag in project annotations (<https://github.com/opencv/cvat/pull/5408>)
- Creating a task with a Git repository via the SDK
(<https://github.com/opencv/cvat/issues/4365>)
- `Project.import_dataset` not waiting for completion correctly
(<https://github.com/opencv/cvat/pull/5459>)
### Security
- TDB
......
......@@ -54,6 +54,7 @@ class Project(
DatasetUploader(self._client).upload_file_and_wait(
self.api.create_dataset_endpoint,
self.api.retrieve_dataset_endpoint,
filename,
format_name,
url_params={"id": self.id},
......
......@@ -325,7 +325,8 @@ class AnnotationUploader(Uploader):
class DatasetUploader(Uploader):
def upload_file_and_wait(
self,
endpoint: Endpoint,
upload_endpoint: Endpoint,
retrieve_endpoint: Endpoint,
filename: Path,
format_name: str,
*,
......@@ -333,12 +334,14 @@ class DatasetUploader(Uploader):
pbar: Optional[ProgressReporter] = None,
status_check_period: Optional[int] = None,
):
url = self._client.api_map.make_endpoint_url(endpoint.path, kwsub=url_params)
url = self._client.api_map.make_endpoint_url(upload_endpoint.path, kwsub=url_params)
params = {"format": format_name, "filename": filename.name}
self.upload_file(
url, filename, pbar=pbar, query_params=params, meta={"filename": params["filename"]}
)
url = self._client.api_map.make_endpoint_url(retrieve_endpoint.path, kwsub=url_params)
params = {"action": "import_status"}
self._wait_for_completion(
url,
success_status=201,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册