随笔分类 -  技术-算法

摘要:master_node = { '1': ['a', 'd'], '2': ['a', 'd'], '4': ['a', 'd']} agent_dict = { '2': ['b', 'f'], '3': ['b', 'f'], '4': ['b', 'f'], } agent_dict = {* 阅读全文
posted @ 2021-09-01 16:50 该显示昵称已被使用了 阅读(215) 评论(0) 推荐(0)
摘要:利用【queue】【BaseManager】 # master #!/usr/bin/env python3 # -*- coding: utf-8 -*- import queue from multiprocessing.managers import BaseManager # 发送任务的队列 阅读全文
posted @ 2021-08-25 15:03 该显示昵称已被使用了 阅读(41) 评论(0) 推荐(0)
摘要:算法中容易遇到的坑 # [2:2]前后相等,什么都获取不到的 list_t = [1,2,3,4,5] print(list_t[2:2]) # [] 阅读全文
posted @ 2021-08-20 10:30 该显示昵称已被使用了 阅读(50) 评论(0) 推荐(0)
摘要:根据node个数,选出数字中node个数的数据进行验证 import time from multiprocessing import Process import os from multiprocessing import Pool import os, time, random # 多线程二分 阅读全文
posted @ 2021-08-17 15:45 该显示昵称已被使用了 阅读(76) 评论(0) 推荐(0)
摘要:思路1,master等待远端返回结果 from multiprocessing import Pool import os, time, random # 在远端执行的任务进程,,hang住等待返回 def long_time_task(ip,url): print('Run task %s-%s 阅读全文
posted @ 2021-08-17 15:25 该显示昵称已被使用了 阅读(41) 评论(0) 推荐(0)
摘要:列表拆分成小列表 l = [i for i in range(16)] n = 3 #大列表中几个数据组成一个小列表 print([l[i:i + n] for i in range(0, len(l), n)]) print([i for i in range(0, len(l), n)]) 使用 阅读全文
posted @ 2021-07-31 16:33 该显示昵称已被使用了 阅读(59) 评论(0) 推荐(0)