Skip to content

Commit

Permalink
ref: wait longer in wait_for_resource
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmueller committed Nov 22, 2024
1 parent 98a4416 commit 5a345ff
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
0.11.3
- ref: wait longer in `wait_for_resource` loop
- ref: turn deprecation in `wait_for_resource` into ValueError
0.11.3
- fix: did not extract `dcor_object_store.ssl_verify` from config
0.11.2
Expand Down
16 changes: 5 additions & 11 deletions dcor_shared/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,7 @@ def wait_for_resource(resource_id: str,
from ckan import logic

if len(resource_id) != 36:
warnings.warn("Please pass the CKAN resource id as `resource_id` "
"instead of a string or a path. This will raise an "
"exception in the future.",
DeprecationWarning)
# The user passed a local path on the block storage. These look like
# this: /data/dcor-instance/resources/RE/SO/URCE-ID
resource_id = "".join(resource_id.split("/")[-3])
raise ValueError(f"Invalid resource id: {resource_id}")

resource_show = logic.get_action("resource_show")
path = pathlib.Path(get_resource_path(resource_id))
Expand All @@ -71,7 +65,7 @@ def wait_for_resource(resource_id: str,
except logic.NotFound:
# Other processes are still working on getting the resource
# online. We have to wait.
time.sleep(0.1)
time.sleep(5)
continue

s3_ok = res_dict.get("s3_available", None)
Expand All @@ -82,17 +76,17 @@ def wait_for_resource(resource_id: str,
# If the dataset is on S3, it is considered to be available.
break
elif not path.exists():
time.sleep(0.05)
time.sleep(5)
continue
elif dcor_depot_available and not path.is_symlink():
# Resource is only available when it is symlinked by
# the ckanext.dcor_depot `symlink_user_dataset` job
# (or by the ckanext.dcor_depot importers).
time.sleep(0.05)
time.sleep(5)
continue
elif path.stat().st_size == ld and path.read_bytes() == DUMMY_BYTES:
# wait a bit
time.sleep(0.01)
time.sleep(5)
continue
else:
# not a dummy file
Expand Down

0 comments on commit 5a345ff

Please sign in to comment.