Ejemplo n.º 1
0
def process_status(pid=None) -> str:
    if jh.is_unit_testing():
        raise EnvironmentError('process_status() is not meant to be called in unit tests')

    if pid is None:
        pid = jh.get_pid()

    key = f"{ENV_VALUES['APP_PORT']}|process-status:{pid}"

    res: str = jh.str_or_none(sync_redis.get(key))
    if res is None:
        raise ValueError(f'No value exists in Redis for process ID of: {pid}')

    return jh.string_after_character(res, ':')
Ejemplo n.º 2
0
def test_string_after_character():
    assert jh.string_after_character('btcusdt@bookTicker', '@') == 'bookTicker'
Ejemplo n.º 3
0
 def cancel_process(self, client_id):
     pid = self.get_pid(client_id)
     pid = jh.string_after_character(pid, '|')
     self._set_process_status(pid, 'stopping')
Ejemplo n.º 4
0
def test_string_after_character():
    assert jh.string_after_character('btcusdt@bookTicker', '@') == 'bookTicker'
    assert jh.string_after_character('9000|24628', '|') == '24628'