Exemple #1
0
    def run_agent(terminate_event, callback_event, reload_request, config_file,
                  name, team, index, python_file, agent_telemetry_queue,
                  queue_holder, match_config: MatchConfig):

        agent_class_wrapper = import_agent(python_file)

        if hasattr(agent_class_wrapper.get_loaded_class(),
                   "run_independently"):
            bm = BotManagerIndependent(terminate_event, callback_event,
                                       reload_request, config_file, name, team,
                                       index, agent_class_wrapper,
                                       agent_telemetry_queue, queue_holder,
                                       match_config)
        elif hasattr(agent_class_wrapper.get_loaded_class(),
                     "get_output_flatbuffer"):
            bm = BotManagerFlatbuffer(terminate_event, callback_event,
                                      reload_request, config_file, name, team,
                                      index, agent_class_wrapper,
                                      agent_telemetry_queue, queue_holder,
                                      match_config)
        else:
            bm = BotManagerStruct(terminate_event, callback_event,
                                  reload_request, config_file, name, team,
                                  index, agent_class_wrapper,
                                  agent_telemetry_queue, queue_holder,
                                  match_config)
        bm.run()
Exemple #2
0
    def run_agent(terminate_event, callback_event, reload_request,
                  bundle: BotConfigBundle, name, team, index, python_file,
                  agent_telemetry_queue, match_config: MatchConfig,
                  matchcomms_root: URL, spawn_id: str):

        agent_class_wrapper = import_agent(python_file)
        config_file = agent_class_wrapper.get_loaded_class(
        ).base_create_agent_configurations()
        config_file.parse_file(bundle.config_obj,
                               config_directory=bundle.config_directory)

        if hasattr(agent_class_wrapper.get_loaded_class(),
                   "run_independently"):
            bm = BotManagerIndependent(terminate_event, callback_event,
                                       reload_request, config_file, name, team,
                                       index, agent_class_wrapper,
                                       agent_telemetry_queue, match_config,
                                       matchcomms_root, spawn_id)
        elif hasattr(agent_class_wrapper.get_loaded_class(),
                     "get_output_flatbuffer"):
            bm = BotManagerFlatbuffer(terminate_event, callback_event,
                                      reload_request, config_file, name, team,
                                      index, agent_class_wrapper,
                                      agent_telemetry_queue, match_config,
                                      matchcomms_root, spawn_id)
        else:
            bm = BotManagerStruct(terminate_event, callback_event,
                                  reload_request, config_file, name, team,
                                  index, agent_class_wrapper,
                                  agent_telemetry_queue, match_config,
                                  matchcomms_root, spawn_id)
        bm.run()
Exemple #3
0
    def run_agent(terminate_event, callback_event, reload_request, bundle: BotConfigBundle, name, team, index,
                  python_file, agent_telemetry_queue, match_config: MatchConfig, matchcomms_root: URL, spawn_id: str):

        # Set the working directory to one level above the bot cfg file.
        # This mimics the behavior you get when executing run.py in one of the
        # example bot repositories, so bots will be more likely to 'just work'
        # even if the developer is careless about file paths.
        os.chdir(Path(bundle.config_directory).parent)

        agent_class_wrapper = import_agent(python_file)
        config_file = agent_class_wrapper.get_loaded_class().base_create_agent_configurations()
        config_file.parse_file(bundle.config_obj, config_directory=bundle.config_directory)

        if hasattr(agent_class_wrapper.get_loaded_class(), "run_independently"):
            bm = BotManagerIndependent(terminate_event, callback_event, reload_request, config_file, name, team, index,
                                       agent_class_wrapper, agent_telemetry_queue, match_config, matchcomms_root,
                                       spawn_id)
        elif hasattr(agent_class_wrapper.get_loaded_class(), "get_output_flatbuffer"):
            bm = BotManagerFlatbuffer(terminate_event, callback_event, reload_request, config_file, name, team, index,
                                      agent_class_wrapper, agent_telemetry_queue, match_config, matchcomms_root,
                                      spawn_id)
        else:
            bm = BotManagerStruct(terminate_event, callback_event, reload_request, config_file, name, team, index,
                                  agent_class_wrapper, agent_telemetry_queue, match_config, matchcomms_root, spawn_id)
        bm.run()