Skip to content

Commit 14638a3

Browse files
committed
Support of reading Working dir from HUAWEI Object Storage Service (OBS)
Signed-off-by: Sergei Sokolov <[email protected]>
1 parent baffe07 commit 14638a3

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

python/ray/_private/runtime_env/packaging.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,14 @@ def __new__(cls, value, doc=None):
8989
HTTPS = "https", "Remote https path, assumes everything packed in one zip file."
9090
S3 = "s3", "Remote s3 path, assumes everything packed in one zip file."
9191
GS = "gs", "Remote google storage path, assumes everything packed in one zip file."
92+
OBS = "obs", "Remote huawei obs path, assumes everything packed in one zip file."
9293
FILE = "file", "File storage path, assumes everything packed in one zip file."
9394

9495
@classmethod
9596
def remote_protocols(cls):
9697
# Returns a list of protocols that support remote storage
9798
# These protocols should only be used with paths that end in ".zip" or ".whl"
98-
return [cls.HTTPS, cls.S3, cls.GS, cls.FILE]
99+
return [cls.HTTPS, cls.S3, cls.GS, cls.FILE, cls.OBS]
99100

100101

101102
def _xor_bytes(left: bytes, right: bytes) -> bytes:
@@ -719,6 +720,16 @@ async def download_and_unpack_package(
719720
"to fetch URIs in Google Cloud Storage bucket."
720721
+ install_warning
721722
)
723+
elif protocol == Protocol.OBS:
724+
try:
725+
from obs import ObsClient # noqa: F401
726+
from smart_open import open as open_file
727+
except ImportError:
728+
raise ImportError(
729+
"You must `pip install smart_open` and "
730+
"`pip install esdk-obs-python` to fetch URIs in obs "
731+
"bucket. " + install_warning
732+
)
722733
elif protocol == Protocol.FILE:
723734
pkg_uri = pkg_uri[len("file://") :]
724735

0 commit comments

Comments
 (0)