def __init__(self, stdout_args: SyncStdoutArgs, ctx_local: multiprocessing.context.SpawnContext, manager: LogManager, pr_list: List[multiprocessing.context.SpawnProcess], /) -> None: super().__init__() create_dirs_rec(stdout_args.working_dir) if manager.run_with_update(True): pr_list.append( ctx_local.Process(target=_waiting_output_str, args=(manager, ))) pr_list[-1].start() self.__logger_data = _LoggerData( lock=ctx_local.RLock(), queue=ctx_local.Queue(), running=CustomProcessValueWrapper[int](ctx_local, 1), finished=CustomProcessValueWrapper[int](ctx_local, 1)) pr_list.append( ctx_local.Process(target=_logger_process, args=(self.__logger_data, stdout_args.working_dir, stdout_args.step_name))) pr_list[-1].start() self.__stats_lock = ctx_local.RLock() self.__logging_stats: _LoggingStats = _LoggingStats( errors_cnt=CustomProcessValueWrapper[int](ctx_local, 0), info_cnt=CustomProcessValueWrapper[int](ctx_local, 0), warn_cnt=CustomProcessValueWrapper[int](ctx_local, 0), other_cnt=CustomProcessValueWrapper[int](ctx_local, 0)) self.__general: _General = _General(g_id=manager.logger_cnt, step=stdout_args.step_name, working_dir=str( stdout_args.working_dir), global_manager=manager) self.__stats: CustomManagedDictWrapper[str, JsonStatsContainerIntFloatList] = \ CustomManagedDictWrapper[str, JsonStatsContainerIntFloatList](ctx_local) self.__end_con: _EndConD = _EndConD( flush_stats=CustomProcessValueWrapper[int](ctx_local, 1), flush_log=CustomProcessValueWrapper[int](ctx_local, 1)) if self.__general.global_manager.manager_error: _increase_error(self.__logging_stats) sys.__stdout__.write( "ERROR occurred in output process (init step)!") sys.__stdout__.flush() else: manager.writer_to_queue((SyncOutMsg( s_id="SyncStdout_{0}".format(self.__general.g_id), msg="SyncStdout_{0} started!".format(self.__general.g_id), status=0.0, done=False), format_message_time))
def __init__(self, ctx: multiprocessing.context.SpawnContext, manager: Optional[SyncManager] = None, /) -> None: super().__init__() manager_local = ctx.Manager() if manager is None else manager self.__managed_dict: Dict[_KeyT, _ValueT] = manager_local.dict({}) self.__manager = manager is None
def __init__(self, ctx_local: multiprocessing.context.SpawnContext, /) -> None: super().__init__() self.__manager_counter = _GlobalCounterCl( prog_counter=CustomProcessValueWrapper[int](ctx_local, 0), done_object_counter=CustomProcessValueWrapper[int](ctx_local, 0), current_msg_line=CustomProcessValueWrapper[int](ctx_local, 1), first_print=CustomProcessValueWrapper[int](ctx_local, 0)) self.__sync_object_manager: CustomManagedDictWrapper[str, _SyncOutSt] = \ CustomManagedDictWrapper[str, _SyncOutSt](ctx_local) self.__manager_lock: synchronize.RLock = ctx_local.RLock() self.__wa_process_attributes: _OutputWaitingProcessTypes = \ _OutputWaitingProcessTypes( run=CustomProcessValueWrapper[int](ctx_local, 0), status=CustomProcessValueWrapper[int](ctx_local, 0), logger_cnt=CustomProcessValueWrapper[int](ctx_local, 0), started=time.time(), id_cnt=CustomProcessValueWrapper[int](ctx_local, 1) ) self.__queue = ctx_local.Queue() self.__error = CustomProcessValueWrapper[int](ctx_local, 0)
def __init__(self, sync_out: SyncStdout, ctx: multiprocessing.context.SpawnContext, work_instance: WorkInterface, re_wr_instance: ReWrInterface, /) -> None: super().__init__() self.__sync_out: SyncStdout = sync_out self.__work_obj: WorkInterface = work_instance self.__re_wr_obj: ReWrInterface = re_wr_instance self.__re_wr_progress: ReWrProgress = ReWrProgress(ctx) self.__loop_pool: Optional[PoolLoopCont] = None self.__locks: _Locks = _Locks(as_lock=None, gl_lock=ctx.Condition()) self.__writer_active: bool = True for cont_type in self.__re_wr_obj.get_connection_write(): if cont_type in (ContainerInterface, NoConnectionContainer): self.__writer_active = False
def __init__(self, ctx: multiprocessing.context.SpawnContext, container_proto: ContainerTypes, puffer_size: int, /) -> None: super().__init__() self.__container_proto: ContainerTypes = container_proto self.__lock_global: synchronize.RLock = ctx.RLock() self.__max: int = puffer_size self.__buffer_structure: Dict[str, _BufferStructure] = {} def create_structure() -> _BufferStructure: return _BufferStructure( locks=_Locks(writer=[ctx.Lock() for _ in range(self.__max)], reader=[ctx.Lock() for _ in range(self.__max)]), heads=_Heads(reader=CustomProcessValueWrapper[int](ctx, 0), writer=CustomProcessValueWrapper[int](ctx, 0)), pipes=[ctx.Pipe(False) for _ in range(self.__max)]) for cont_type in container_proto: self.__buffer_structure[cont_type.__name__] = create_structure()
def _create_float_value(ctx: multiprocessing.context.SpawnContext, value: float, /) -> _SyncCValue: return ctx.Value('f', value)
def __init__(self, ctx: multiprocessing.context.SpawnContext, /) -> None: super().__init__() self.__end = _EndType(error=CustomProcessValueWrapper[int](ctx, 0), term=CustomProcessValueWrapper[int](ctx, -1)) self.__lock_re_wr: synchronize.RLock = ctx.RLock()