

def _single_run(kwargs):
    " Performs a single run of the experiment.\n\n    :param kwargs: Dict of arguments\n\n        traj: The trajectory containing all parameters set to the corresponding run index.\n\n        runfunc: The user's job function\n\n        runargs: The arguments handed to the user's job function (as *args)\n\n        runkwargs: The keyword arguments handed to the user's job function (as **kwargs)\n\n        clean_up_after_run: Whether to clean up after the run\n\n        automatic_storing: Whether or not the data should be automatically stored\n\n        result_queue: A queue object to store results into in case a pool is used, otherwise None\n\n    :return:\n\n        Results computed by the user's job function which are not stored into the trajectory.\n        Returns a nested tuple of run index and result and run information:\n        ``((traj.v_idx, result), run_information_dict)``\n\n    "
    pypet_root_logger = logging.getLogger('pypet')
    traj = kwargs['traj']
    runfunc = kwargs['runfunc']
    runargs = kwargs['runargs']
    kwrunparams = kwargs['runkwargs']
    clean_up_after_run = kwargs['clean_up_runs']
    automatic_storing = kwargs['automatic_storing']
    wrap_mode = kwargs['wrap_mode']
    idx = traj.v_idx
    total_runs = len(traj)
    pypet_root_logger.info(('\n=========================================\n Starting single run #%d of %d \n=========================================\n' % (idx, total_runs)))
    traj.f_start_run(turn_into_run=True)
    result = runfunc(traj, *runargs, **kwrunparams)
    if automatic_storing:
        traj.f_store()
    if (wrap_mode == pypetconstants.WRAP_MODE_LOCAL):
        result = ((traj.v_idx, result), traj.f_get_run_information(traj.v_idx, copy=False), traj.v_storage_service.references)
        traj.v_storage_service.free_references()
    else:
        result = ((traj.v_idx, result), traj.f_get_run_information(traj.v_idx, copy=False))
    traj.f_finalize_run(store_meta_data=False, clean_up=clean_up_after_run)
    pypet_root_logger.info(('\n=========================================\n Finished single run #%d of %d \n=========================================\n' % (idx, total_runs)))
    return result

dataset/ETHPy150Open SmokinCaterpillar/pypet/pypet/environment.py _single_run/original