Пример #1
0
def test_setup_logging():
    logger.debug('test_setup_logging')
    dir_logs = Path(__file__).parent / 'logs'

    with restore_logging():
        setup_logging()

    with restore_logging():
        setup_logging(dir_logs=dir_logs)

    assert dir_logs.exists()
Пример #2
0
def test_get_session_logfiles():
    logger.debug('test_get_session_logfiles')
    with restore_logging():
        # Create a parent log file
        setup_logging(dir_logs=Path(__file__).parent / 'logs')
        debug_handler = get_debug_handler()
        debug_handler.doRollover()
        debug_handler.doRollover()
        assert len(get_session_logfiles()) == 3
        assert all([log.startswith(debug_handler.baseFilename)
                    for log in get_session_logfiles()])
Пример #3
0
import os.path
import sys

from hutch_python.load_conf import load
from hutch_python.log_setup import setup_logging
from pcdsdaq.sim import set_sim_mode

sys.path.insert(0, "/reg/g/pcds/pyps/apps/hutch-python/tst")

# Do the normal hutch-python loading
set_sim_mode(True)
cfg = '/cds/group/pcds/pyps/apps/hutch-python/tst/conf.yml'
setup_logging(dir_logs=os.path.join(os.path.dirname(cfg), 'logs'))
objs = load(cfg=cfg)

# Make some post-adjustments for queue-server
# Disable the bec plots for the server process (keep the table)
objs['bec'].disable_plots()
# Make all objects available to queue-server
globals().update(objs)
# Additionally expand the plan namespace so that the queue-server sees it
globals().update(vars(objs['bp']))
# Additionally expand the experiment object so that the queue-server sees it
try:
    globals().update(vars(objs['user']))
except KeyError:
    pass