Modified elasticsearch file name to 'elastic' to avoid name errors. Applied changes suggested in the pr.
							parent
							
								
									3ce8bfa012
								
							
						
					
					
						commit
						b5cdf14036
					
				| 
						 | 
					@ -124,6 +124,8 @@ class Container:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    async def process_logs_until(
 | 
					    async def process_logs_until(
 | 
				
			||||||
        self,
 | 
					        self,
 | 
				
			||||||
 | 
					        # this is a predicate func for matching log msgs emitted by the
 | 
				
			||||||
 | 
					        # underlying containerized app
 | 
				
			||||||
        patt_matcher: Callable[[str], bool],
 | 
					        patt_matcher: Callable[[str], bool],
 | 
				
			||||||
        bp_on_msg: bool = False,
 | 
					        bp_on_msg: bool = False,
 | 
				
			||||||
    ) -> bool:
 | 
					    ) -> bool:
 | 
				
			||||||
| 
						 | 
					@ -152,7 +154,7 @@ class Container:
 | 
				
			||||||
                    elif 'message' in record:
 | 
					                    elif 'message' in record:
 | 
				
			||||||
                        msg = record['message']
 | 
					                        msg = record['message']
 | 
				
			||||||
                    else:
 | 
					                    else:
 | 
				
			||||||
                        raise KeyError('Unexpected log format')
 | 
					                        raise KeyError(f'Unexpected log format\n{record}')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    level = record['level']
 | 
					                    level = record['level']
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -25,43 +25,37 @@
 | 
				
			||||||
'''
 | 
					'''
 | 
				
			||||||
from __future__ import annotations
 | 
					from __future__ import annotations
 | 
				
			||||||
from contextlib import asynccontextmanager as acm
 | 
					from contextlib import asynccontextmanager as acm
 | 
				
			||||||
from datetime import datetime
 | 
					 | 
				
			||||||
from pprint import pformat
 | 
					from pprint import pformat
 | 
				
			||||||
from typing import (
 | 
					from typing import (
 | 
				
			||||||
    Any,
 | 
					    Any,
 | 
				
			||||||
    Optional,
 | 
					    # Optional,
 | 
				
			||||||
    Union,
 | 
					    #Union,
 | 
				
			||||||
    TYPE_CHECKING,
 | 
					    TYPE_CHECKING,
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
import time
 | 
					 | 
				
			||||||
from math import isnan
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
from bidict import bidict
 | 
					 | 
				
			||||||
from msgspec.msgpack import encode, decode
 | 
					 | 
				
			||||||
import pyqtgraph as pg
 | 
					import pyqtgraph as pg
 | 
				
			||||||
import numpy as np
 | 
					import numpy as np
 | 
				
			||||||
import tractor
 | 
					import tractor
 | 
				
			||||||
from trio_websocket import open_websocket_url
 | 
					
 | 
				
			||||||
import pendulum
 | 
					 | 
				
			||||||
import purerpc
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
if TYPE_CHECKING:
 | 
					if TYPE_CHECKING:
 | 
				
			||||||
    import docker
 | 
					    import docker
 | 
				
			||||||
    from ._ahab import DockerContainer
 | 
					    from ._ahab import DockerContainer
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from .feed import maybe_open_feed
 | 
					from piker.log import (
 | 
				
			||||||
from ..log import get_logger, get_console_log
 | 
					    get_logger,
 | 
				
			||||||
from .._profile import Profiler
 | 
					    get_console_log
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from elasticsearch import Elasticsearch
 | 
					from elasticsearch import Elasticsearch
 | 
				
			||||||
from docker.types import LogConfig
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
log = get_logger(__name__)
 | 
					log = get_logger(__name__)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# container level config
 | 
					# container level config
 | 
				
			||||||
_config = {
 | 
					_config = {
 | 
				
			||||||
    'port': 9200,
 | 
					    'port': 19200,
 | 
				
			||||||
    'log_level': 'debug',
 | 
					    'log_level': 'debug',
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -103,6 +97,6 @@ def start_elasticsearch(
 | 
				
			||||||
        dcntr,
 | 
					        dcntr,
 | 
				
			||||||
        {},
 | 
					        {},
 | 
				
			||||||
        # expected startup and stop msgs
 | 
					        # expected startup and stop msgs
 | 
				
			||||||
        lambda msg: msg == "started",
 | 
					        lambda start_msg: start_msg == "started",
 | 
				
			||||||
        lambda msg: msg == "closed",
 | 
					        lambda stop_msg: stop_msg == "closed",
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
| 
						 | 
					@ -194,8 +194,8 @@ def start_marketstore(
 | 
				
			||||||
        _config,
 | 
					        _config,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # expected startup and stop msgs
 | 
					        # expected startup and stop msgs
 | 
				
			||||||
        lambda msg: "launching tcp listener for all services..." in msg,
 | 
					        lambda start_msg: "launching tcp listener for all services..." in start_msg,
 | 
				
			||||||
        lambda msg: "exiting..." in msg,
 | 
					        lambda stop_msg: "exiting..." in stop_msg,
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -119,6 +119,8 @@ def cse_symbols():
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@acm
 | 
					@acm
 | 
				
			||||||
async def _open_test_pikerd(
 | 
					async def _open_test_pikerd(
 | 
				
			||||||
 | 
					    tsdb: bool = False,
 | 
				
			||||||
 | 
					    es: bool = False,
 | 
				
			||||||
    reg_addr: tuple[str, int] | None = None,
 | 
					    reg_addr: tuple[str, int] | None = None,
 | 
				
			||||||
    **kwargs,
 | 
					    **kwargs,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -143,6 +145,8 @@ async def _open_test_pikerd(
 | 
				
			||||||
    # try:
 | 
					    # try:
 | 
				
			||||||
    async with (
 | 
					    async with (
 | 
				
			||||||
        maybe_open_pikerd(
 | 
					        maybe_open_pikerd(
 | 
				
			||||||
 | 
					            tsdb=tsdb,
 | 
				
			||||||
 | 
					            es=es,
 | 
				
			||||||
            registry_addr=reg_addr,
 | 
					            registry_addr=reg_addr,
 | 
				
			||||||
            **kwargs,
 | 
					            **kwargs,
 | 
				
			||||||
        ) as service_manager,
 | 
					        ) as service_manager,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue