Skip to content

Commit

Permalink
fix: remove wait for Object.promote on synchronous execution
Browse files Browse the repository at this point in the history
Signed-off-by: Tony Chen <[email protected]>
  • Loading branch information
Nahemah1022 committed Jul 1, 2024
1 parent d259b8b commit f7c581d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/python_sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -1328,7 +1328,7 @@ See more info here: https://aiatscale.org/blog/2022/03/17/promote

**Returns**:

Job ID (as str) that can be used to check the status of the operation
Job ID (as str) that can be used to check the job's status; empty ("") if the job failed or executed synchronously


**Raises**:
Expand Down
2 changes: 1 addition & 1 deletion python/aistore/sdk/object.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ def promote(
src_not_file_share (bool, optional): Optimize if the source is guaranteed to not be on a file share
Returns:
Job ID (as str) that can be used to check the status of the operation
Job ID (as str) that can be used to check the status of the operation, or empty if job is done synchronously
Raises:
requests.RequestException: "There was an ambiguous exception that occurred while handling..."
Expand Down
10 changes: 8 additions & 2 deletions python/tests/integration/sdk/test_object_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,10 @@ def test_promote(self):
# Promote to AIS bucket
obj_name = "promoted_obj/"
promote_job = self.bucket.object(obj_name).promote(str(local_files_path))
self.client.job(job_id=promote_job).wait_for_idle(timeout=TEST_TIMEOUT)

# If the promote is executed as an asynchronous job, wait until it completes
if promote_job:
self.client.job(job_id=promote_job).wait_for_idle(timeout=TEST_TIMEOUT)

# Check bucket, only top object is promoted
self.assertEqual(1, len(self.bucket.list_all_objects()))
Expand All @@ -239,7 +242,10 @@ def test_promote(self):
delete_source=True,
overwrite_dest=True,
)
self.client.job(job_id=promote_job).wait_for_idle(timeout=TEST_TIMEOUT)

# If the promote is executed as an asynchronous job, wait until it completes
if promote_job:
self.client.job(job_id=promote_job).wait_for_idle(timeout=TEST_TIMEOUT)

# Check bucket, both objects promoted, top overwritten
self.assertEqual(2, len(self.bucket.list_all_objects()))
Expand Down

0 comments on commit f7c581d

Please sign in to comment.