当前位置: 首页>>代码示例>>Python>>正文


Python Agent.start方法代码示例

本文整理汇总了Python中agent.Agent.start方法的典型用法代码示例。如果您正苦于以下问题:Python Agent.start方法的具体用法?Python Agent.start怎么用?Python Agent.start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在agent.Agent的用法示例。


在下文中一共展示了Agent.start方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: hello_world

# 需要导入模块: from agent import Agent [as 别名]
# 或者: from agent.Agent import start [as 别名]
def hello_world():
	get_ntp_time()
	e = threading.Event()
	ip, port, message = "10.1.1.2", 9999, 'Hello World'
	interval = 1
	counter = 20
	t1 = Agent(e,interval,counter,ip,port,message)
	t1.start()
	return message
开发者ID:Gigglebit,项目名称:stats_exp,代码行数:11,代码来源:agentmanager.py

示例2: accept

# 需要导入模块: from agent import Agent [as 别名]
# 或者: from agent.Agent import start [as 别名]
    def accept(self, conn, addr):
        self._count += 1
        a = Agent(conn, conn)
        h = EchoHandler(a)
        a.handler = h

        logger.info("Starting Agent for connection %d", self._count)
        a.start()
        a.wait()
        logger.info("Agent finished connection %d",self._count)
开发者ID:egarbi,项目名称:kapacitor,代码行数:12,代码来源:echo.py

示例3: create_agent

# 需要导入模块: from agent import Agent [as 别名]
# 或者: from agent.Agent import start [as 别名]
 def create_agent(self, device):
     datapath_id = device.datapath_id
     device_id = device.id
     for controller_endpoint in self.controller_endpoints:
         agent = Agent(controller_endpoint, datapath_id,
                       device_id, self.grpc_client, self.enable_tls,
                       self.key_file, self.cert_file)
         agent.start()
         self.agent_map[(datapath_id,controller_endpoint)] = agent
         self.device_id_to_datapath_id_map[device_id] = datapath_id
开发者ID:gcgirish-radisys,项目名称:voltha,代码行数:12,代码来源:connection_mgr.py

示例4: main

# 需要导入模块: from agent import Agent [as 别名]
# 或者: from agent.Agent import start [as 别名]
def main():
  """ Main function, runs the experiment. """
  agent = Agent()
  env = init_env()
  for i in range(15):
    agent.start()
    state, reward = env.reset()
    while not env.terminal:
      action = agent.step(state, reward)
      state, reward = env.update(action)
    
    agent.end(reward)
开发者ID:KyriacosShiarli,项目名称:helicopter,代码行数:14,代码来源:experiment.py

示例5: point

# 需要导入模块: from agent import Agent [as 别名]
# 或者: from agent.Agent import start [as 别名]
        response = udf_pb2.Response()
        response.begin.CopyFrom(begin_req)
        self._agent.write_response(response)

    def point(self, point):
        value = point.fieldsDouble[self._field]
        self._state.update(value, point)

    def end_batch(self, end_req):
        outliers = self._state.outliers(self._scale)
        response = udf_pb2.Response()
        for outlier in outliers:
            response.point.CopyFrom(outlier)
            self._agent.write_response(response)

        # Send an identical end batch back to Kapacitor
        response.end.CopyFrom(end_req)
        self._agent.write_response(response)


if __name__ == '__main__':
    a = Agent()
    h = OutliersHandler(a)
    a.handler = h

    logger.info("Starting Agent")
    a.start()
    a.wait()
    logger.info("Agent finished")

开发者ID:3fr61n,项目名称:kapacitor,代码行数:31,代码来源:outliers.py

示例6: __init__

# 需要导入模块: from agent import Agent [as 别名]
# 或者: from agent.Agent import start [as 别名]

#.........这里部分代码省略.........
                     Pair(4, 'Fisch', '6'),
                     Pair(5, 'Gans',  '5'),
                     Pair(6, 'Hemd',  '4'),
                     Pair(7, 'Jagd',  '3'),
                     Pair(8, 'Kind',  '2'),
                     Pair(9, 'Laub',  '1'),
                     Pair(10, 'Milch', '0'),
                     Pair(11, 'Nuss',  '9'),
                     Pair(12, 'Pilz',  '8'),
                     Pair(13, 'Quarz', '7'),
                     Pair(14, 'Rot',   '6'),
                     Pair(15, 'Stern', '5'),
                     Pair(16, 'Schuh', '4'),
                     Pair(17, 'Taxi',  '3'),
                     Pair(18, 'Vers',  '2'),
                     Pair(19, 'Wald',  '1'),
                     Pair(20, 'Zink',  '0')]


        random.shuffle(self.pairs)

        self.index = 0
        self.current_run = 0
        self.total_runs = 8
        self.round_data = [[] for r in range(self.total_runs)]

        now = datetime.datetime.now()
        log_name = 'log\log-' + str(now.hour) + '_' + str(now.minute) + '_' + str(now.second) + '.csv'
        self.logger = Logger(log_name)

        self.logger.save('run', 'task','word','number','answer','correct','responsetime','timestamp')

        self.agent = Agent(use_wasabi, self.logger)
        self.start_time = 0
        self.start_time_answer = 0
        self.answer_given = False

        self.test_nr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
        self.test_correct = 0
        self.test_nr_index = -1


    def train_number(self):
        self.test_nr_index = self.test_nr_index + 1
        self.agent.marc.subtitle(self.test_nr[self.test_nr_index])


    def check_nr(self, received):
        if received != str(self.test_nr[self.test_nr_index]):
            self.agent.marc.headNo()
            print 'received is false'
        else:
            self.agent.marc.headYes()
            self.test_correct += 1
            print 'recieved is corrrect'

    def subtitle(self, text, duration='2.0'):
        self.agent.marc.subtitle(text,duration)


    def save_start_time(self):
        self.start_time = datetime.datetime.now()
        self.agent.emo_module.wasabi.log_wasabi=True
        

    def start(self):
开发者ID:philipstahl,项目名称:emotutor,代码行数:70,代码来源:environment.py


注:本文中的agent.Agent.start方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。