Exemplo n.º 1
0
    def get_helper_process_request(self) -> HelperProcessRequest:
        from multiprocessing import Pipe

        file = self.get_manager_path()
        key = 'swarm_manager'
        request = HelperProcessRequest(file, key)
        self.pipe, request.pipe = Pipe(False)
        request.model_path = self.model_path
        request.load_model = self.load_model
        return request
Exemplo n.º 2
0
 def get_helper_process_request(self):
     if self.is_executable_configured():
         return HelperProcessRequest(python_file_path=None,
                                     key=__file__ + str(self.get_port()),
                                     executable=self.executable_path,
                                     exe_args=[str(self.get_port())])
     return None
Exemplo n.º 3
0
    def get_helper_process_request(self) -> HelperProcessRequest:

        filepath = os.path.join(os.path.dirname(__file__), 'hivemind.py')
        # Differentiates between teams so each team has its own hivemind.
        key = 'Blue Hivemind' if self.team == 0 else 'Orange Hivemind'
        options = {}
        request = HelperProcessRequest(filepath, key, options=options)

        return request
Exemplo n.º 4
0
 def get_helper_process_request(self):
     if self.is_executable_configured():
         return HelperProcessRequest(
             python_file_path=None,
             key=__file__ + str(self.port),
             executable=self.cpp_executable_path,
             exe_args=["-dll-path",
                       game_interface.get_dll_directory()])
     return None
Exemplo n.º 5
0
 def get_helper_process_request(self):
     if self.is_executable_configured():
         return HelperProcessRequest(
             python_file_path=None,
             key=__file__ + str(self.port),
             executable=self.java_executable_path,
             current_working_directory=os.path.dirname(
                 self.java_executable_path))
     return None
Exemplo n.º 6
0
    def get_helper_process_request(self) -> HelperProcessRequest:
        from multiprocessing import Pipe

        file = os.path.realpath(
            os.path.join(os.path.dirname(os.path.abspath(__file__)),
                         'torch_manager.py'))
        key = 'hive_mind'
        request = HelperProcessRequest(file, key)
        self.pipe, request.pipe = Pipe(False)
        return request
Exemplo n.º 7
0
 def get_helper_process_request(self):
     file = os.path.realpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'scratch_manager.py'))
     self.logger.info(self.sb3file)
     key = 'scratch_helper' + (self.sb3file or '') + str(self.port)
     options = {
         'port': self.port,
         'spawn_browser': self.spawn_browser,
         'sb3-file': self.sb3file,
         'headless': self.headless
     }
     return HelperProcessRequest(file, key, options=options)
Exemplo n.º 8
0
    def get_helper_process_request(self) -> HelperProcessRequest:
        if not os.path.isfile(self.hive_path):
            raise FileNotFoundError(f'Could not find file: {self.hive_path}')

        # Appends hive_path to key so that hiveminds in different places don't compete.
        # Appends team to key so that each team has its own hivemind.
        key = f'{self.hive_path}{self.hive_key}{self.team}'

        # Creates request for helper process.
        options = {'name': self.hive_name}

        return HelperProcessRequest(self.hive_path, key, options=options)
Exemplo n.º 9
0
 def get_helper_process_request(self):
     if self.is_executable_configured():
         return HelperProcessRequest(
             python_file_path=None,
             key=__file__ + str(self.get_port()),
             executable=self.executable_path,
             exe_args=[
                 str(self.get_port()), f'--server.port={ACTION_SERVER_PORT}'
             ],
             current_working_directory=os.path.dirname(
                 self.executable_path))
     return None
Exemplo n.º 10
0
 def get_helper_process_request(self):
     file = os.path.realpath(scratch_manager.__file__)
     self.logger.info(self.sb3file)
     port = self.port + self.index if self.separate_browsers else self.port
     key = f'scratch_helper{self.sb3file or ""}-{port}'
     options = {
         'port': port,
         'spawn_browser': self.spawn_browser,
         'sb3-file': self.sb3file,
         'headless': self.headless,
         'pretend_blue_team': self.pretend_blue_team
     }
     return HelperProcessRequest(file, key, options=options)
Exemplo n.º 11
0
    def get_helper_process_request(self) -> HelperProcessRequest:
        """Requests a helper process"""

        # Filepath to the hivemind file. If you rename it, also rename it here.
        filepath = os.path.join(os.path.dirname(__file__), 'hivemind.py')

        # Differentiates between teams so each team has its own hivemind.
        # Make sure to make the keys something unique, otherwise other people's hiveminds could take over.
        key = 'Blue Example Hivemind' if self.team == 0 else 'Orange Example Hivemind'

        # Creates request for helper process.
        options = {}
        request = HelperProcessRequest(filepath, key, options=options)

        return request
Exemplo n.º 12
0
    def get_helper_process_request(self):
        if self.is_executable_configured():
            exe_args = [str(self.get_port())]
            if (self.matchcomms_root is not None):
                exe_args.extend(
                    ["--matchcomms-url",
                     self.matchcomms_root.geturl()])

            return HelperProcessRequest(
                python_file_path=None,
                key=__file__ + str(self.get_port()),
                executable=self.executable_path,
                exe_args=exe_args,
                current_working_directory=os.path.dirname(
                    self.executable_path))
        return None
Exemplo n.º 13
0
 def get_helper_process_request(self):
     if AUTORUN:
         return HelperProcessRequest(python_file_path=None,
                                     key=self.name + str(self.port),
                                     executable=self.auto_run_path)
     return None
Exemplo n.º 14
0
 def get_helper_process_request(self):
     if self.is_executable_configured():
         return HelperProcessRequest(python_file_path=None,
                                     key=__file__ + str(self.port),
                                     executable=self.dotnet_executable_path)
     return None
Exemplo n.º 15
0
 def get_helper_process_request(self):
     file = os.path.realpath(
         os.path.join(os.path.dirname(os.path.abspath(__file__)),
                      'scratch_manager.py'))
     key = 'scratch_helper'
     return HelperProcessRequest(file, key)
Exemplo n.º 16
0
 def get_helper_process_request(self) -> HelperProcessRequest:
     controller_path = pathlib.Path(__file__).parent.joinpath("recorder_process.py")
     options = {"index": self.index}
     return HelperProcessRequest(
         python_file_path=controller_path, key=self.name, options=options
     )