Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1,541 changed files
with
290,915 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,5 +4,4 @@ | |
*/.mypy_cache | ||
*/.pytest_cache | ||
*/build | ||
*/*/_mars | ||
**/node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Copyright 2022-2023 XProbe Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
from . import _version | ||
from .config import options | ||
from .core.context import get_context | ||
from .deploy.oscar import new_cluster_in_ray, new_ray_session | ||
from .session import execute, fetch, fetch_log, new_session, stop_server | ||
|
||
__version__ = _version.get_versions()["version"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# Copyright 2022-2023 XProbe Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
cdef class Resource: | ||
cdef readonly: | ||
float num_cpus | ||
float num_gpus | ||
float mem_bytes | ||
|
||
def __init__(self, float num_cpus=0, float num_gpus=0, float mem_bytes=0): | ||
self.num_cpus = num_cpus | ||
self.num_gpus = num_gpus | ||
self.mem_bytes = mem_bytes | ||
|
||
def __eq__(self, Resource other): | ||
cdef bint ret = ( | ||
self.mem_bytes == other.mem_bytes | ||
and self.num_gpus == other.num_gpus | ||
and self.num_cpus == other.num_cpus | ||
) | ||
return ret | ||
|
||
cdef bint _le(self, Resource other) nogil: | ||
# memory first, then gpu, cpu last | ||
cdef bint ret = ( | ||
self.mem_bytes <= other.mem_bytes | ||
and self.num_gpus <= other.num_gpus | ||
and self.num_cpus <= other.num_cpus | ||
) | ||
return ret | ||
|
||
def __gt__(self, Resource other): | ||
return not self._le(other) | ||
|
||
def __le__(self, Resource other): | ||
return self._le(other) | ||
|
||
def __add__(self, Resource other): | ||
return Resource( | ||
num_cpus=self.num_cpus + other.num_cpus, | ||
num_gpus=self.num_gpus + other.num_gpus, | ||
mem_bytes=self.mem_bytes + other.mem_bytes, | ||
) | ||
|
||
def __sub__(self, Resource other): | ||
return Resource( | ||
num_cpus=self.num_cpus - other.num_cpus, | ||
num_gpus=self.num_gpus - other.num_gpus, | ||
mem_bytes=self.mem_bytes - other.mem_bytes, | ||
) | ||
|
||
def __neg__(self): | ||
return Resource( | ||
num_cpus=-self.num_cpus, | ||
num_gpus=-self.num_gpus, | ||
mem_bytes=-self.mem_bytes, | ||
) | ||
|
||
def __repr__(self): | ||
return f"Resource(num_cpus={self.num_cpus}, num_gpus={self.num_gpus}, mem_bytes={self.mem_bytes})" | ||
|
||
ZeroResource = Resource(num_cpus=0, num_gpus=0, mem_bytes=0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Copyright 2022-2023 XProbe Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
|
||
cdef class TypeDispatcher: | ||
cdef dict _handlers | ||
cdef dict _lazy_handlers | ||
cdef dict _inherit_handlers | ||
cdef object __weakref__ | ||
|
||
cpdef void register(self, object type_, object handler) | ||
cpdef void unregister(self, object type_) | ||
cdef _reload_lazy_handlers(self) | ||
cpdef get_handler(self, object type_) | ||
|
||
|
||
cpdef str to_str(s, encoding=*) | ||
cpdef bytes to_binary(s, encoding=*) | ||
cpdef unicode to_text(s, encoding=*) | ||
cpdef register_tokenizer(cls, handler) | ||
cpdef void reset_id_random_seed() except * | ||
cpdef bytes new_random_id(int byte_len) |
Oops, something went wrong.