Increase shm size to days of 1s steps

mkts_backup
Tyler Goodlet 2022-04-01 13:45:33 -04:00
parent 098c4f25fc
commit addb0a4928
1 changed files with 3 additions and 9 deletions

View File

@ -19,7 +19,6 @@ NumPy compatible shared memory buffers for real-time IPC streaming.
""" """
from __future__ import annotations from __future__ import annotations
from dataclasses import dataclass, asdict
from sys import byteorder from sys import byteorder
from typing import Optional from typing import Optional
from multiprocessing.shared_memory import SharedMemory, _USE_POSIX from multiprocessing.shared_memory import SharedMemory, _USE_POSIX
@ -30,7 +29,7 @@ if _USE_POSIX:
import tractor import tractor
import numpy as np import numpy as np
from pydantic import BaseModel, validator from pydantic import BaseModel
from ..log import get_logger from ..log import get_logger
from ._source import base_iohlc_dtype from ._source import base_iohlc_dtype
@ -296,11 +295,6 @@ class ShmArray:
except ValueError as err: except ValueError as err:
if field_map: if field_map:
raise raise
# dsize = data.size
# if dsize > self._len:
# raise ValueError(
# f'Input data is size {dsize} > our shm buffer {self._len}'
# )
# should raise if diff detected # should raise if diff detected
self.diff_err_fields(data) self.diff_err_fields(data)
@ -357,7 +351,7 @@ class ShmArray:
# how much is probably dependent on lifestyle # how much is probably dependent on lifestyle
_secs_in_day = int(60 * 60 * 24) _secs_in_day = int(60 * 60 * 24)
# we try for 3 times but only on a run-every-other-day kinda week. # we try for 3 times but only on a run-every-other-day kinda week.
_default_size = 4 * _secs_in_day _default_size = 6 * _secs_in_day
def open_shm_array( def open_shm_array(
@ -427,7 +421,7 @@ def open_shm_array(
# this sets the index to 3/4 of the length of the buffer # this sets the index to 3/4 of the length of the buffer
# leaving a "days worth of second samples" for the real-time # leaving a "days worth of second samples" for the real-time
# section. # section.
last.value = first.value = int(3*_secs_in_day) last.value = first.value = int(5*_secs_in_day)
shmarr = ShmArray( shmarr = ShmArray(
array, array,