Skip to content

Commit

Permalink
move: Immediately authenticate client after creation
Browse files Browse the repository at this point in the history
In order to deal with embargoed Dandisets
  • Loading branch information
jwodder committed Aug 9, 2024
1 parent 9ae6128 commit 9af7226
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions dandi/move.py
Original file line number Diff line number Diff line change
Expand Up @@ -812,6 +812,7 @@ def move(
raise TypeError("`dandiset` must be a Path when work_on='both'")
local_ds, subpath = find_dandiset_and_subpath(dandiset)
client = DandiAPIClient.for_dandi_instance(dandi_instance)
client.dandi_authenticate()

Check warning on line 815 in dandi/move.py

View check run for this annotation

Codecov / codecov/patch

dandi/move.py#L815

Added line #L815 was not covered by tests
stack.enter_context(client)
remote_ds = client.get_dandiset(
local_ds.identifier, version_id="draft", lazy=False
Expand All @@ -833,6 +834,7 @@ def move(
if not isinstance(url, DandisetURL):
raise ValueError("URL does not point to a Dandiset")
client = url.get_client()
client.dandi_authenticate()

Check warning on line 837 in dandi/move.py

View check run for this annotation

Codecov / codecov/patch

dandi/move.py#L837

Added line #L837 was not covered by tests
stack.enter_context(client)
rds = url.get_dandiset(client, lazy=False)
assert rds is not None
Expand All @@ -841,6 +843,7 @@ def move(
else:
local_ds, subpath = find_dandiset_and_subpath(dandiset)
client = DandiAPIClient.for_dandi_instance(dandi_instance)
client.dandi_authenticate()

Check warning on line 846 in dandi/move.py

View check run for this annotation

Codecov / codecov/patch

dandi/move.py#L846

Added line #L846 was not covered by tests
stack.enter_context(client)
remote_ds = client.get_dandiset(
local_ds.identifier, version_id="draft", lazy=False
Expand All @@ -866,8 +869,6 @@ def move(
if not plan:
lgr.info("Nothing to move")
return
if not dry_run and client is not None:
client.dandi_authenticate()
if devel_debug:
for gen in mover.process_moves_debug(plan, dry_run):
for r in gen:
Expand Down

0 comments on commit 9af7226

Please sign in to comment.