-
Notifications
You must be signed in to change notification settings - Fork 328
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Wrap errors in operand execution to protect scheduling service (#2964)
- Loading branch information
Showing
18 changed files
with
392 additions
and
57 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
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,13 @@ | ||
# Copyright 1999-2022 Alibaba Group Holding Ltd. | ||
# | ||
# 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. |
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,30 @@ | ||
# Copyright 1999-2022 Alibaba Group Holding Ltd. | ||
# | ||
# 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. | ||
|
||
# complementary header for C++ STL libs not included in Cython | ||
|
||
from libc.stdint cimport uint_fast64_t | ||
|
||
|
||
cdef extern from "<random>" namespace "std" nogil: | ||
cdef cppclass mt19937_64: | ||
ctypedef uint_fast64_t result_type | ||
|
||
mt19937_64() except + | ||
mt19937_64(result_type seed) except + | ||
result_type operator()() except + | ||
result_type min() except + | ||
result_type max() except + | ||
void discard(size_t z) except + | ||
void seed(result_type seed) except + |
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,214 @@ | ||
# Copyright 1999-2022 Alibaba Group Holding Ltd. | ||
# | ||
# 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 enum import Enum | ||
from types import TracebackType | ||
from typing import Any, Type | ||
|
||
from ..core import ActorRef | ||
|
||
DEFAULT_PROTOCOL: int = 0 | ||
|
||
class MessageType(Enum): | ||
control = 0 | ||
result = 1 | ||
error = 2 | ||
create_actor = 3 | ||
destroy_actor = 4 | ||
has_actor = 5 | ||
actor_ref = 6 | ||
send = 7 | ||
tell = 8 | ||
cancel = 9 | ||
|
||
class ControlMessageType(Enum): | ||
stop = 0 | ||
restart = 1 | ||
sync_config = 2 | ||
get_config = 3 | ||
wait_pool_recovered = 4 | ||
add_sub_pool_actor = 5 | ||
|
||
class _MessageBase: | ||
message_type: MessageType | ||
protocol: int | ||
message_id: bytes | ||
message_trace: list | ||
profiling_context: Any | ||
|
||
def __init__( | ||
self, | ||
message_id: bytes = None, | ||
protocol: int = DEFAULT_PROTOCOL, | ||
message_trace: list = None, | ||
profiling_context: Any = None, | ||
): ... | ||
def __repr__(self): ... | ||
|
||
class ControlMessage(_MessageBase): | ||
message_type = MessageType.control | ||
|
||
address: str | ||
control_message_type: ControlMessageType | ||
content: Any | ||
|
||
def __init__( | ||
self, | ||
message_id: bytes = None, | ||
address: str = None, | ||
control_message_type: ControlMessageType = None, | ||
content: Any = None, | ||
protocol: int = DEFAULT_PROTOCOL, | ||
): ... | ||
|
||
class ResultMessage(_MessageBase): | ||
message_type = MessageType.result | ||
|
||
result: Any | ||
|
||
def __init__( | ||
self, | ||
message_id: bytes = None, | ||
result: Any = None, | ||
protocol: int = DEFAULT_PROTOCOL, | ||
message_trace: list = None, | ||
profiling_context: Any = None, | ||
): ... | ||
|
||
class ErrorMessage(_MessageBase): | ||
message_type = MessageType.error | ||
|
||
address: str | ||
pid: int | ||
error_type: Type | ||
error: BaseException | ||
traceback: TracebackType | ||
|
||
def __init__( | ||
self, | ||
message_id: bytes = None, | ||
address: str = None, | ||
pid: int = -1, | ||
error_type: Type[BaseException] = None, | ||
error: BaseException = None, | ||
traceback: TracebackType = None, | ||
protocol: int = DEFAULT_PROTOCOL, | ||
message_trace: list = None, | ||
): ... | ||
def as_instanceof_cause(self) -> BaseException: ... | ||
|
||
class CreateActorMessage(_MessageBase): | ||
message_type = MessageType.create_actor | ||
|
||
actor_cls: Type | ||
actor_id: bytes | ||
args: tuple | ||
kwargs: dict | ||
allocate_strategy: Any | ||
from_main: bool | ||
|
||
def __init__( | ||
self, | ||
message_id: bytes = None, | ||
actor_cls: Type = None, | ||
actor_id: bytes = None, | ||
args: tuple = None, | ||
kwargs: dict = None, | ||
allocate_strategy: Any = None, | ||
from_main: bool = False, | ||
protocol: int = DEFAULT_PROTOCOL, | ||
message_trace: list = None, | ||
): ... | ||
|
||
class DestroyActorMessage(_MessageBase): | ||
message_type = MessageType.destroy_actor | ||
|
||
actor_ref: ActorRef | ||
from_main: bool | ||
|
||
def __init__( | ||
self, | ||
message_id: bytes = None, | ||
actor_ref: ActorRef = None, | ||
from_main: bool = False, | ||
protocol: int = DEFAULT_PROTOCOL, | ||
message_trace: list = None, | ||
): ... | ||
|
||
class HasActorMessage(_MessageBase): | ||
message_type = MessageType.has_actor | ||
|
||
actor_ref: ActorRef | ||
|
||
def __init__( | ||
self, | ||
message_id: bytes = None, | ||
actor_ref: ActorRef = None, | ||
protocol: int = DEFAULT_PROTOCOL, | ||
message_trace: list = None, | ||
): ... | ||
|
||
class ActorRefMessage(_MessageBase): | ||
message_type = MessageType.actor_ref | ||
|
||
actor_ref: ActorRef | ||
|
||
def __init__( | ||
self, | ||
message_id: bytes = None, | ||
actor_ref: ActorRef = None, | ||
protocol: int = DEFAULT_PROTOCOL, | ||
message_trace: list = None, | ||
): ... | ||
|
||
class SendMessage(_MessageBase): | ||
message_type = MessageType.send | ||
|
||
actor_ref: ActorRef | ||
content: Any | ||
|
||
def __init__( | ||
self, | ||
message_id: bytes = None, | ||
actor_ref: ActorRef = None, | ||
content: object = None, | ||
protocol: int = DEFAULT_PROTOCOL, | ||
message_trace: list = None, | ||
profiling_context: Any = None, | ||
): ... | ||
|
||
class TellMessage(SendMessage): | ||
message_type = MessageType.tell | ||
|
||
class CancelMessage(_MessageBase): | ||
message_type = MessageType.cancel | ||
|
||
address: str | ||
cancel_message_id: bytes | ||
|
||
def __init__( | ||
self, | ||
message_id: bytes = None, | ||
address: str = None, | ||
cancel_message_id: bytes = None, | ||
protocol: int = DEFAULT_PROTOCOL, | ||
message_trace: list = None, | ||
): ... | ||
|
||
class DeserializeMessageFailed(RuntimeError): | ||
def __init__(self, message_id: bytes): ... | ||
def __str__(self): ... | ||
|
||
def reset_random_seed(): ... | ||
def new_message_id() -> bytes: ... |
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
Oops, something went wrong.