loky/backend/spawn.py
def prepare(data):
    '''
    Try to get current process ready to unpickle process object
    '''
    if 'name' in data:
        process.current_process().name = data['name']

    if 'authkey' in data:
        process.current_process().authkey = data['authkey']

    if 'log_to_stderr' in data and data['log_to_stderr']:
        util.log_to_stderr()

    if 'log_level' in data:
        util.get_logger().setLevel(data['log_level'])

    if 'log_fmt' in data:
        import logging
        util.get_logger().handlers[0].setFormatter(
            logging.Formatter(data['log_fmt'])
        )

    if 'sys_path' in data:
        sys.path = data['sys_path']

    if 'sys_argv' in data:
        sys.argv = data['sys_argv']

    if 'dir' in data:
        os.chdir(data['dir'])

    if 'orig_dir' in data:
        process.ORIGINAL_DIR = data['orig_dir']

    if 'tracker_pid' in data:
        from . import semaphore_tracker
        semaphore_tracker._semaphore_tracker._pid = data["tracker_pid"]

    if 'init_main_from_name' in data:
        _fixup_main_from_name(data['init_main_from_name'])
    elif 'init_main_from_path' in data:
        _fixup_main_from_path(data['init_main_from_path'])
def prepare(data):
    '''
    Try to get current process ready to unpickle process object
    '''
    if 'name' in data:
        process.current_process().name = data['name']

    if 'authkey' in data:
        process.current_process().authkey = data['authkey']

    if 'log_to_stderr' in data and data['log_to_stderr']:
        util.log_to_stderr()

    if 'log_level' in data:
        util.get_logger().setLevel(data['log_level'])

    if 'log_fmt' in data:
        import logging
        util.get_logger().handlers[0].setFormatter(
            logging.Formatter(data['log_fmt'])
        )

    if 'sys_path' in data:
        sys.path = data['sys_path']

    if 'sys_argv' in data:
        sys.argv = data['sys_argv']

    if 'dir' in data:
        os.chdir(data['dir'])

    if 'orig_dir' in data:
        process.ORIGINAL_DIR = data['orig_dir']

    if 'tracker_pid' in data:
        from . import semaphore_tracker
        semaphore_tracker._semaphore_tracker._pid = data["tracker_pid"]

    if 'init_main_from_name' in data:
        _fixup_main_from_name(data['init_main_from_name'])
    elif 'init_main_from_path' in data:
        _fixup_main_from_path(data['init_main_from_path'])
def prepare ( data ) : if 'name' in data : process . current_process ( ) . name = data [ 'name' ] if 'authkey' in data : process . current_process ( ) . authkey = data [ 'authkey' ] if 'log_to_stderr' in data and data [ 'log_to_stderr' ] : util . log_to_stderr ( ) if 'log_level' in data : util . get_logger ( ) . setLevel ( data [ 'log_level' ] ) if 'log_fmt' in data : import logging util . get_logger ( ) . handlers [ 0 ] . setFormatter ( logging . Formatter ( data [ 'log_fmt' ] ) ) if 'sys_path' in data : sys . path = data [ 'sys_path' ] if 'sys_argv' in data : sys . argv = data [ 'sys_argv' ] if 'dir' in data : os . chdir ( data [ 'dir' ] ) if 'orig_dir' in data : process . ORIGINAL_DIR = data [ 'orig_dir' ] if 'tracker_pid' in data : from . import semaphore_tracker semaphore_tracker . _semaphore_tracker . _pid = data [ "tracker_pid" ] if 'init_main_from_name' in data : _fixup_main_from_name ( data [ 'init_main_from_name' ] ) elif 'init_main_from_path' in data : _fixup_main_from_path ( data [ 'init_main_from_path' ] )
Try to get current process ready to unpickle process object
Try to get current process ready to unpickle process object