def define_tests_some_pairs_(cx, db, objspec1, objspec2, objs1, objs2, func, dynamic, create_reports): results = {} jobs = {} combinations = iterate_context_names_pair(cx, list(objs1), list(objs2), key1=objspec1.name, key2=objspec2.name) for c, id_ob1, id_ob2 in combinations: assert_job_exists(objs1[id_ob1], db) assert_job_exists(objs2[id_ob2], db) ob1 = Promise(objs1[id_ob1]) ob2 = Promise(objs2[id_ob2]) params = dict(job_id='f', command_name=func.__name__) if dynamic: res = c.comp_config_dynamic(wrap_func_pair_dyn, func, id_ob1, ob1, id_ob2, ob2, **params) else: res = c.comp_config(wrap_func_pair, func, id_ob1, ob1, id_ob2, ob2, **params) results[(id_ob1, id_ob2)] = res jobs[(id_ob1, id_ob2)] = res.job_id if create_reports: r = cx.comp_dynamic(report_results_pairs_jobs, func, objspec1.name, objspec2.name, jobs) cx.add_report(r, 'jobs_pairs_some') r = cx.comp(report_results_pairs, func, objspec1.name, objspec2.name, results) cx.add_report(r, 'pairs_some')
def define_tests_pairs(context, objspec1, names2test_objects, pairs, create_reports): objs1 = names2test_objects[objspec1.name] if not pairs: print('No %s+x pairs mcdp_lang_tests.' % (objspec1.name)) return else: print('%d %s+x pairs mcdp_lang_tests.' % (len(pairs), objspec1.name)) for x in pairs: objspec2 = x['objspec2'] func = x['function'] dynamic = x['dynamic'] cx = context.child(func.__name__) cx.add_extra_report_keys(objspec1=objspec1.name, objspec2=objspec2.name, function=func.__name__, type='pairs') objs2 = names2test_objects[objspec2.name] if not objs2: print('No objects %r for pairs' % objspec2.name) continue results = {} jobs = {} db = context.cc.get_compmake_db() combinations = iterate_context_names_pair(cx, list(objs1), list(objs2), key1=objspec1.name, key2=objspec2.name) for c, id_ob1, id_ob2 in combinations: assert_job_exists(objs1[id_ob1], db) assert_job_exists(objs2[id_ob2], db) ob1 = Promise(objs1[id_ob1]) ob2 = Promise(objs2[id_ob2]) params = dict(job_id='f', command_name=func.__name__) if dynamic: res = c.comp_config_dynamic(wrap_func_pair_dyn, func, id_ob1, ob1, id_ob2, ob2, **params) else: res = c.comp_config(wrap_func_pair, func, id_ob1, ob1, id_ob2, ob2, **params) results[(id_ob1, id_ob2)] = res jobs[(id_ob1, id_ob2)] = res.job_id warnings.warn('disabled report functionality') if create_reports: r = cx.comp_dynamic(report_results_pairs_jobs, func, objspec1.name, objspec2.name, jobs) cx.add_report(r, 'jobs_pairs') r = cx.comp(report_results_pairs, func, objspec1.name, objspec2.name, results) cx.add_report(r, 'pairs')
def define_jobs_context(self, context): get_diffeo2ddslearn_config().load('default') estimators = DDSLDemo1.estimators streams = DDSLDemo1.streams children = iterate_context_names_pair(context, streams, estimators) for c, stream, estimator in children: c.subtask(DDSLLearnParallel, stream=stream, estimator=estimator, max_displ=0.24)
def iterate_context_combinations(context, combinations): robots = set() agents = set() robots_agents = set() # (robot, agent) tuple for robot, agent in combinations: robots.add(robot) agents.add(agent) robots_agents.add((robot, agent)) robots = sorted(list(robots)) agents = sorted(list(agents)) for c, id_robot, id_agent in iterate_context_names_pair(context, robots, agents): if not (id_robot, id_agent) in robots_agents: continue yield c, id_robot, id_agent
def define_jobs_context(self, context): boot_root = self.get_boot_root() data_central = self.get_data_central() GlobalConfig.global_load_dir('default') recipe_agentlearn_by_parallel(context, data_central, Exp29.explogs_learn) for id_robot in Exp29.robots: recipe_episodeready_by_convert2(context, boot_root, id_robot) combinations = iterate_context_names_pair(context, Exp29.nmaps, Exp29.robots) for c, id_episode, id_robot in combinations: jobs_navigation_map(c, outdir=context.get_output_dir(), data_central=data_central, id_robot=id_robot, id_episode=id_episode)
def schedule_(context, generated, testing_functions): for c, f, g in iterate_context_names_pair(context, testing_functions, generated): c.comp_dynamic(f, g)