Skip to content

Commit

Permalink
Support of reading Working dir from HUAWEI Object Storage Service (OBS)
Browse files Browse the repository at this point in the history
Signed-off-by: Sergei Sokolov <[email protected]>
  • Loading branch information
imhy committed May 28, 2024
1 parent baffe07 commit 3960b69
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion python/ray/_private/runtime_env/packaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,14 @@ def __new__(cls, value, doc=None):
HTTPS = "https", "Remote https path, assumes everything packed in one zip file."
S3 = "s3", "Remote s3 path, assumes everything packed in one zip file."
GS = "gs", "Remote google storage path, assumes everything packed in one zip file."
OBS = "obs", "Remote huawei object storage service path, assumes everything packed in one zip file."
FILE = "file", "File storage path, assumes everything packed in one zip file."

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


def _xor_bytes(left: bytes, right: bytes) -> bytes:
Expand Down Expand Up @@ -719,6 +720,16 @@ async def download_and_unpack_package(
"to fetch URIs in Google Cloud Storage bucket."
+ install_warning
)
elif protocol == Protocol.OBS:
try:
from obs import ObsClient # noqa: F401
from smart_open import open as open_file
except ImportError:
raise ImportError(
"You must `pip install smart_open` and "
"`pip install esdk-obs-python` to fetch URIs in obs "
"bucket. " + install_warning
)
elif protocol == Protocol.FILE:
pkg_uri = pkg_uri[len("file://") :]

Expand Down

0 comments on commit 3960b69

Please sign in to comment.