Skip to content

Commit 95681af

Browse files
authored
fix job.status() in tests and CircleCI caching (#347)
* fix test and circleci caching * fix page size * fix AsyncJob test * lint * changelog * fix job test
1 parent 275c6a5 commit 95681af

File tree

7 files changed

+36
-9
lines changed

7 files changed

+36
-9
lines changed

.circleci/config.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,16 @@ jobs:
2323
apt-get -y install curl libgeos-dev
2424
pip install --upgrade pip
2525
pip install poetry
26-
- python/install-packages:
27-
include-python-in-cache-key: false
28-
pkg-manager: poetry
26+
- run:
27+
name: Install Python Dependencies
28+
command: |
29+
poetry install
2930
- run:
3031
name: Test Imports (extras need to be guarded!)
3132
command: | # Make sure that importing works without extras installed
3233
poetry run python -c 'import nucleus'
3334
- run:
34-
name: Install Extra Dependencies
35+
name: Install Extra Python Dependencies
3536
command: | # install dependencies
3637
poetry install -E metrics -E launch
3738
- run:

CHANGELOG.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,15 @@ All notable changes to the [Nucleus Python Client](https://github.com/scaleapi/n
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8-
## [0.14.16](https://github.com/scaleapi/nucleus-python-client/releases/tag/v0.14.15) - 2022-08-12
8+
## [0.14.17](https://github.com/scaleapi/nucleus-python-client/releases/tag/v0.14.17) - 2022-08-15
9+
10+
### Fixed
11+
- Fix `AsyncJob` status payload keys causing test failures
12+
- Fix `AsyncJob` export test
13+
- Fix `page_size` for `{Dataset,Slice}.items_and_annotatation_generator()`
14+
- Change to simple dependency install step to fix CircleCI caching failures
15+
16+
## [0.14.16](https://github.com/scaleapi/nucleus-python-client/releases/tag/v0.14.16) - 2022-08-12
917

1018
### Added
1119
- Scene cateogorization support

nucleus/dataset.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1256,7 +1256,7 @@ def items_and_annotation_generator(
12561256
client=self._client,
12571257
endpoint=f"dataset/{self.id}/exportForTrainingPage",
12581258
result_key=EXPORT_FOR_TRAINING_KEY,
1259-
page_size=100000,
1259+
page_size=10000, # max ES page size
12601260
)
12611261
for data in json_generator:
12621262
for ia in convert_export_payload([data], has_predictions=False):

nucleus/slice.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ def items_and_annotation_generator(
246246
client=self._client,
247247
endpoint=f"slice/{self.id}/exportForTrainingPage",
248248
result_key=EXPORT_FOR_TRAINING_KEY,
249-
page_size=100000,
249+
page_size=10000, # max ES page size
250250
)
251251
for data in json_generator:
252252
for ia in convert_export_payload([data], has_predictions=False):

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ exclude = '''
2121

2222
[tool.poetry]
2323
name = "scale-nucleus"
24-
version = "0.14.16"
24+
version = "0.14.17"
2525
description = "The official Python client library for Nucleus, the Data Platform for AI"
2626
license = "MIT"
2727
authors = ["Scale AI Nucleus Team <nucleusapi@scaleapi.com>"]

tests/test_jobs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def test_repr(test_object: any):
2323
)
2424

2525

26-
def test_job_creation_and_listing_and_retrieval(CLIENT):
26+
def test_job_listing_and_retrieval(CLIENT):
2727
jobs = CLIENT.list_jobs()
2828

2929
if not jobs:

tests/test_scene.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,7 @@ def test_scene_upload_async(dataset_scene):
420420
job.sleep_until_complete()
421421
status = job.status()
422422

423+
del status["job_creation_time"] # HACK: too flaky to try syncing
423424
assert status == {
424425
"job_id": job.job_id,
425426
"status": "Completed",
@@ -436,6 +437,8 @@ def test_scene_upload_async(dataset_scene):
436437
"job_progress": "1.00",
437438
"completed_steps": 1,
438439
"total_steps": 1,
440+
"job_last_known_status": "Completed",
441+
"job_type": "uploadLidarScene",
439442
}
440443

441444
uploaded_scenes = dataset_scene.scenes
@@ -462,6 +465,7 @@ def test_scene_upload_and_update(dataset_scene):
462465
job.sleep_until_complete()
463466
status = job.status()
464467

468+
del status["job_creation_time"] # HACK: too flaky to try syncing
465469
assert status == {
466470
"job_id": job.job_id,
467471
"status": "Completed",
@@ -478,6 +482,8 @@ def test_scene_upload_and_update(dataset_scene):
478482
"job_progress": "1.00",
479483
"completed_steps": 1,
480484
"total_steps": 1,
485+
"job_last_known_status": "Completed",
486+
"job_type": "uploadLidarScene",
481487
}
482488

483489
uploaded_scenes = dataset_scene.scenes
@@ -495,6 +501,7 @@ def test_scene_upload_and_update(dataset_scene):
495501
job2.sleep_until_complete()
496502
status2 = job2.status()
497503

504+
del status2["job_creation_time"] # HACK: too flaky to try syncing
498505
assert status2 == {
499506
"job_id": job2.job_id,
500507
"status": "Completed",
@@ -511,6 +518,8 @@ def test_scene_upload_and_update(dataset_scene):
511518
"job_progress": "1.00",
512519
"completed_steps": 1,
513520
"total_steps": 1,
521+
"job_last_known_status": "Completed",
522+
"job_type": "uploadLidarScene",
514523
}
515524

516525

@@ -585,6 +594,7 @@ def test_video_scene_upload_async(dataset_scene):
585594
job.sleep_until_complete()
586595
status = job.status()
587596

597+
del status["job_creation_time"] # HACK: too flaky to try syncing
588598
assert status == {
589599
"job_id": job.job_id,
590600
"status": "Completed",
@@ -601,6 +611,8 @@ def test_video_scene_upload_async(dataset_scene):
601611
"job_progress": "1.00",
602612
"completed_steps": len(scenes),
603613
"total_steps": len(scenes),
614+
"job_last_known_status": "Completed",
615+
"job_type": "uploadVideoScene",
604616
}
605617

606618
uploaded_scenes = dataset_scene.scenes
@@ -681,6 +693,7 @@ def test_video_scene_upload_and_update(dataset_scene):
681693
job.sleep_until_complete()
682694
status = job.status()
683695

696+
del status["job_creation_time"] # HACK: too flaky to try syncing
684697
assert status == {
685698
"job_id": job.job_id,
686699
"status": "Completed",
@@ -697,6 +710,8 @@ def test_video_scene_upload_and_update(dataset_scene):
697710
"job_progress": "1.00",
698711
"completed_steps": len(scenes),
699712
"total_steps": len(scenes),
713+
"job_last_known_status": "Completed",
714+
"job_type": "uploadVideoScene",
700715
}
701716

702717
uploaded_scenes = dataset_scene.scenes
@@ -715,6 +730,7 @@ def test_video_scene_upload_and_update(dataset_scene):
715730
job2.sleep_until_complete()
716731
status2 = job2.status()
717732

733+
del status2["job_creation_time"] # HACK: too flaky to try syncing
718734
assert status2 == {
719735
"job_id": job2.job_id,
720736
"status": "Completed",
@@ -731,6 +747,8 @@ def test_video_scene_upload_and_update(dataset_scene):
731747
"job_progress": "1.00",
732748
"completed_steps": len(scenes),
733749
"total_steps": len(scenes),
750+
"job_last_known_status": "Completed",
751+
"job_type": "uploadVideoScene",
734752
}
735753

736754

0 commit comments

Comments
 (0)