Skip to content

Commit f6b439b

Browse files
committed
fix: Support creating new resources with BossDB volume provider
1 parent 4ca2b1b commit f6b439b

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

intern/convenience/array.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
import psutil
2727
import warnings
2828

29+
from requests.exceptions import HTTPError
30+
2931
import numpy as np
3032
from PIL import Image
3133

@@ -914,9 +916,15 @@ def _infer_volume_provider(channel: Union[ChannelResource, str, Tuple]):
914916
if isinstance(channel, str):
915917
if channel.startswith("bossdb://"):
916918
channel_uri = _parse_bossdb_uri(channel)
917-
channel_obj = _BossDBVolumeProvider().get_channel(
918-
channel_uri.channel, channel_uri.collection, channel_uri.experiment
919-
)
919+
try:
920+
channel_obj = _BossDBVolumeProvider().get_channel(
921+
channel_uri.channel, channel_uri.collection, channel_uri.experiment
922+
)
923+
except HTTPError:
924+
# If the resource is not found, it is probably because we are
925+
# creating a new resource...
926+
return _BossDBVolumeProvider()
927+
920928
if channel_obj.raw["storage_type"] == "cloudvol" and HAS_CLOUDVOLUME:
921929
return _CloudVolumeOpenDataVolumeProvider(
922930
{

0 commit comments

Comments
 (0)