File tree Expand file tree Collapse file tree 3 files changed +29
-3
lines changed Expand file tree Collapse file tree 3 files changed +29
-3
lines changed Original file line number Diff line number Diff line change 29
29
ERROR_CODES = "error_codes"
30
30
ERROR_ITEMS = "upload_errors"
31
31
ERROR_PAYLOAD = "error_payload"
32
+ FRAMES = "frames"
32
33
GEOMETRY_KEY = "geometry"
33
34
HEIGHT_KEY = "height"
34
35
IGNORED_ITEMS = "ignored_items"
Original file line number Diff line number Diff line change 23
23
DATASET_SLICES_KEY ,
24
24
DEFAULT_ANNOTATION_UPDATE_MODE ,
25
25
EXPORTED_ROWS ,
26
+ FRAMES ,
26
27
JOB_ID_KEY ,
27
28
NAME_KEY ,
28
29
REFERENCE_IDS_KEY ,
@@ -253,9 +254,23 @@ def upload_scene(
253
254
update : Optional [bool ] = False ,
254
255
asynchronous : bool = False ,
255
256
) -> Union [dict , AsyncJob ]:
256
- """TODO: add docstring here"""
257
+ """
258
+ Uploads scene with given frames to the dataset
259
+
260
+ Parameters:
261
+ :param payload: dictionary containing frames to be uploaded as a scene
262
+ :param update: if True, overwrite scene on collision
263
+ :param aynchronous: if True, return a job object representing asynchronous ingestion job
264
+ :return:
265
+ {
266
+ 'dataset_id': str,
267
+ 'new_items': int,
268
+ 'updated_items': int,
269
+ 'ignored_items': int,
270
+ }
271
+ """
257
272
if asynchronous :
258
- check_all_frame_paths_remote (payload ["frames" ])
273
+ check_all_frame_paths_remote (payload [FRAMES ])
259
274
request_id = serialize_and_write_to_presigned_url (
260
275
[payload ], self .id , self ._client
261
276
)
Original file line number Diff line number Diff line change @@ -21,7 +21,6 @@ def dataset(CLIENT):
21
21
assert response == {"message" : "Beginning dataset deletion..." }
22
22
23
23
24
- @pytest .mark .integration
25
24
def test_scene_upload_sync (dataset ):
26
25
payload = TEST_LIDAR_FRAMES
27
26
response = dataset .upload_scene (payload )
@@ -31,6 +30,17 @@ def test_scene_upload_sync(dataset):
31
30
assert response ["updated_items" ] == 0
32
31
assert response ["ignored_items" ] == 0
33
32
33
+
34
+ @pytest .mark .integration
35
+ def test_scene_and_cuboid_upload_sync (dataset ):
36
+ payload = TEST_LIDAR_FRAMES
37
+ response = dataset .upload_scene (payload )
38
+
39
+ assert response ["dataset_id" ] == dataset .id
40
+ assert response ["new_items" ] == 1
41
+ assert response ["updated_items" ] == 0
42
+ assert response ["ignored_items" ] == 0
43
+
34
44
TEST_CUBOID_ANNOTATIONS [0 ]["dataset_item_id" ] = dataset .items [0 ].item_id
35
45
annotation = CuboidAnnotation .from_json (TEST_CUBOID_ANNOTATIONS [0 ])
36
46
response = dataset .annotate (annotations = [annotation ])
You can’t perform that action at this time.
0 commit comments