cengal.parallel_execution.coroutines.coro_standard_services.remote_nodes.versions.v_0.commands

Module Docstring Docstrings: http://www.python.org/dev/peps/pep-0257/

  1#!/usr/bin/env python
  2# coding=utf-8
  3
  4# Copyright © 2012-2024 ButenkoMS. All rights reserved. Contacts: <gtalk@butenkoms.space>
  5# 
  6# Licensed under the Apache License, Version 2.0 (the "License");
  7# you may not use this file except in compliance with the License.
  8# You may obtain a copy of the License at
  9# 
 10#     http://www.apache.org/licenses/LICENSE-2.0
 11# 
 12# Unless required by applicable law or agreed to in writing, software
 13# distributed under the License is distributed on an "AS IS" BASIS,
 14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 15# See the License for the specific language governing permissions and
 16# limitations under the License.
 17
 18
 19"""
 20Module Docstring
 21Docstrings: http://www.python.org/dev/peps/pep-0257/
 22"""
 23
 24
 25__author__ = "ButenkoMS <gtalk@butenkoms.space>"
 26__copyright__ = "Copyright © 2012-2024 ButenkoMS. All rights reserved. Contacts: <gtalk@butenkoms.space>"
 27__credits__ = ["ButenkoMS <gtalk@butenkoms.space>", ]
 28__license__ = "Apache License, Version 2.0"
 29__version__ = "4.4.1"
 30__maintainer__ = "ButenkoMS <gtalk@butenkoms.space>"
 31__email__ = "gtalk@butenkoms.space"
 32# __status__ = "Prototype"
 33__status__ = "Development"
 34# __status__ = "Production"
 35
 36
 37from enum import Enum
 38
 39
 40class Fields(Enum):
 41    command_name = 0  # See Commands class. Optional: if ommited then: 1) if `in_response_to` present then default is `send_response`; 2) if `in_response_to` is not present then default is `send_request`
 42    request_id = 1  # id of either request or response (requests and responses must have an independent counters)
 43    in_response_to = 2  # current response is a response to request with this ID. Optional: can be present only in `send_response`
 44    is_response_required = 3  # int. 1 = required; 0 = not required. Optional: if ommited then default is 0 (not required). This gives us ability to send smallest response-less request as possible. Even is not required, response still can be send. If required - response must be send.
 45    data_serializer_id = 4  # If data was serialized explicitly with some serializer (Pickle for example). Optional.
 46    data = 5  # Data. Format depends on request type (command type). Optional: if ommited then default is None.
 47
 48
 49class Commands(Enum):
 50    # suggest_best_serializers_list = 0  # client suggests list of it's best serializers (first is fastest)
 51    # declare_best_serializers_list = 1  # server respondes with a sublist of apropriate sugested serializers (first is fastest)
 52    declare_client_node = 0
 53    declare_server_node = 1
 54    declare_service_class = 2  # client sends service class name, it's unique ID (int starting from 0, generated on the client side), it's module importable str (path) and it's module full file path
 55    declare_service_request_class = 3  # client sends service ID, service request class name and it's unique ID (int starting from 0, generated on the client side)
 56    send_request = 4  # raw request
 57    send_service_request = 5
 58    send_service_request_with_request_class = 6
 59    send_response = 6
 60
 61
 62# === Commands ====================
 63class CommandDataFieldsDeclareClientNode(Enum):
 64    platform_name = 0
 65    suggested_serializers = 1
 66
 67
 68class CommandDataFieldsDeclareServerNode(Enum):
 69    platform_name = 0
 70    declared_serializers = 1
 71
 72
 73class CommandDataFieldsDeclareServiceClass(Enum):
 74    local_id = 0
 75    class_name = 1
 76    module_importable_str = 2
 77
 78
 79class CommandDataFieldsDeclareServiceRequestClass(Enum):
 80    local_id = 0
 81    class_name = 1
 82    module_importable_str = 2
 83    properties_tuple = 3
 84
 85
 86class CommandDataFieldsRequest:
 87    args = 0
 88    kwargs = 1
 89
 90
 91class CommandDataFieldsServiceRequest:
 92    service_class_id = 0
 93    args = 1
 94    kwargs = 2
 95
 96
 97class CommandDataFieldsServiceRequestWithRequestClass:
 98    service_class_id = 0
 99    request_class_id = 1
100    properties_tuple = 3
class Fields(enum.Enum):
41class Fields(Enum):
42    command_name = 0  # See Commands class. Optional: if ommited then: 1) if `in_response_to` present then default is `send_response`; 2) if `in_response_to` is not present then default is `send_request`
43    request_id = 1  # id of either request or response (requests and responses must have an independent counters)
44    in_response_to = 2  # current response is a response to request with this ID. Optional: can be present only in `send_response`
45    is_response_required = 3  # int. 1 = required; 0 = not required. Optional: if ommited then default is 0 (not required). This gives us ability to send smallest response-less request as possible. Even is not required, response still can be send. If required - response must be send.
46    data_serializer_id = 4  # If data was serialized explicitly with some serializer (Pickle for example). Optional.
47    data = 5  # Data. Format depends on request type (command type). Optional: if ommited then default is None.

An enumeration.

command_name = <Fields.command_name: 0>
request_id = <Fields.request_id: 1>
in_response_to = <Fields.in_response_to: 2>
is_response_required = <Fields.is_response_required: 3>
data_serializer_id = <Fields.data_serializer_id: 4>
data = <Fields.data: 5>
Inherited Members
enum.Enum
name
value
class Commands(enum.Enum):
50class Commands(Enum):
51    # suggest_best_serializers_list = 0  # client suggests list of it's best serializers (first is fastest)
52    # declare_best_serializers_list = 1  # server respondes with a sublist of apropriate sugested serializers (first is fastest)
53    declare_client_node = 0
54    declare_server_node = 1
55    declare_service_class = 2  # client sends service class name, it's unique ID (int starting from 0, generated on the client side), it's module importable str (path) and it's module full file path
56    declare_service_request_class = 3  # client sends service ID, service request class name and it's unique ID (int starting from 0, generated on the client side)
57    send_request = 4  # raw request
58    send_service_request = 5
59    send_service_request_with_request_class = 6
60    send_response = 6

An enumeration.

declare_client_node = <Commands.declare_client_node: 0>
declare_server_node = <Commands.declare_server_node: 1>
declare_service_class = <Commands.declare_service_class: 2>
declare_service_request_class = <Commands.declare_service_request_class: 3>
send_request = <Commands.send_request: 4>
send_service_request = <Commands.send_service_request: 5>
send_service_request_with_request_class = <Commands.send_service_request_with_request_class: 6>
Inherited Members
enum.Enum
name
value
class CommandDataFieldsDeclareClientNode(enum.Enum):
64class CommandDataFieldsDeclareClientNode(Enum):
65    platform_name = 0
66    suggested_serializers = 1

An enumeration.

Inherited Members
enum.Enum
name
value
class CommandDataFieldsDeclareServerNode(enum.Enum):
69class CommandDataFieldsDeclareServerNode(Enum):
70    platform_name = 0
71    declared_serializers = 1

An enumeration.

Inherited Members
enum.Enum
name
value
class CommandDataFieldsDeclareServiceClass(enum.Enum):
74class CommandDataFieldsDeclareServiceClass(Enum):
75    local_id = 0
76    class_name = 1
77    module_importable_str = 2

An enumeration.

Inherited Members
enum.Enum
name
value
class CommandDataFieldsDeclareServiceRequestClass(enum.Enum):
80class CommandDataFieldsDeclareServiceRequestClass(Enum):
81    local_id = 0
82    class_name = 1
83    module_importable_str = 2
84    properties_tuple = 3

An enumeration.

Inherited Members
enum.Enum
name
value
class CommandDataFieldsRequest:
87class CommandDataFieldsRequest:
88    args = 0
89    kwargs = 1
args = 0
kwargs = 1
class CommandDataFieldsServiceRequest:
92class CommandDataFieldsServiceRequest:
93    service_class_id = 0
94    args = 1
95    kwargs = 2
service_class_id = 0
args = 1
kwargs = 2
class CommandDataFieldsServiceRequestWithRequestClass:
 98class CommandDataFieldsServiceRequestWithRequestClass:
 99    service_class_id = 0
100    request_class_id = 1
101    properties_tuple = 3
service_class_id = 0
request_class_id = 1
properties_tuple = 3