cengal.parallel_execution.coroutines.coro_standard_services.shutdown_loop.versions.v_0.shutdown_loop

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"""
19Module Docstring
20Docstrings: http://www.python.org/dev/peps/pep-0257/
21"""
22
23__author__ = "ButenkoMS <gtalk@butenkoms.space>"
24__copyright__ = "Copyright © 2012-2024 ButenkoMS. All rights reserved. Contacts: <gtalk@butenkoms.space>"
25__credits__ = ["ButenkoMS <gtalk@butenkoms.space>", ]
26__license__ = "Apache License, Version 2.0"
27__version__ = "4.4.1"
28__maintainer__ = "ButenkoMS <gtalk@butenkoms.space>"
29__email__ = "gtalk@butenkoms.space"
30# __status__ = "Prototype"
31__status__ = "Development"
32# __status__ = "Production"
33
34
35__all__ = ['ShutdownLoop']
36
37
38from cengal.parallel_execution.coroutines.coro_scheduler import *
39from typing import Tuple
40
41
42class ShutdownLoop(TypedService[None]):
43    def single_task_registration_or_immediate_processing(
44            self, *args, **kwargs) -> Tuple[bool, None, None]:
45        raise CoroSchedulerDestroyRequestedException
46        return True, None, None
47
48    def full_processing_iteration(self):
49        self.make_dead()
50
51    def in_work(self) -> bool:
52        result: bool = False
53        return self.thrifty_in_work(result)
class ShutdownLoop(cengal.parallel_execution.coroutines.coro_scheduler.versions.v_0.coro_scheduler.TypedService[NoneType]):
43class ShutdownLoop(TypedService[None]):
44    def single_task_registration_or_immediate_processing(
45            self, *args, **kwargs) -> Tuple[bool, None, None]:
46        raise CoroSchedulerDestroyRequestedException
47        return True, None, None
48
49    def full_processing_iteration(self):
50        self.make_dead()
51
52    def in_work(self) -> bool:
53        result: bool = False
54        return self.thrifty_in_work(result)

Abstract base class for generic types.

A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as::

class Mapping(Generic[KT, VT]): def __getitem__(self, key: KT) -> VT: ... # Etc.

This class can then be used as follows::

def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default

def single_task_registration_or_immediate_processing(self, *args, **kwargs) -> Tuple[bool, NoneType, NoneType]:
44    def single_task_registration_or_immediate_processing(
45            self, *args, **kwargs) -> Tuple[bool, None, None]:
46        raise CoroSchedulerDestroyRequestedException
47        return True, None, None
def full_processing_iteration(self):
49    def full_processing_iteration(self):
50        self.make_dead()
def in_work(self) -> bool:
52    def in_work(self) -> bool:
53        result: bool = False
54        return self.thrifty_in_work(result)

Will be executed twice per iteration: once before and once after the full_processing_iteration() execution

Raises: NotImplementedError: _description_

Returns: bool: _description_

Inherited Members
cengal.parallel_execution.coroutines.coro_scheduler.versions.v_0.coro_scheduler.Service
Service
current_caller_coro_info
iteration
make_response
register_response
put_task
resolve_request
try_resolve_request
in_forground_work
thrifty_in_work
time_left_before_next_event
is_low_latency
make_live
make_dead
service_id_impl
service_id
destroy