def __get_compile_cmds(self, task: Task, args: list): """ Get compilation command to compile all of the task source files. :param task: related task :param args: additional arguments :return: list of compilation commands """ compiler = task.get_compiler() if '' != compiler: bin_path = task.path_to_task_bin(self.__workdir) if not os.path.exists(bin_path): os.makedirs(bin_path) path = task.path_to_task_src(self.__workdir) if task.is_file_archive(): if self.__cmake_handler is not None and task.uses_cmake(): if not self.__cmake_handler.is_cmake_target(path): self.__cmake_handler.create_cmake_lists(task) commands = self.__cmake_handler.get_compilation_commands_using_cmake( task) else: commands = self.__no_cmake_compile_cmd( compiler, task, args) else: commands = self.__get_compile_cmd_for_single_file( compiler, task, args) self.__log_writer.log(json.dumps(commands, indent=4), level=LogLevel.DEBUG) return commands else: raise RuntimeError('No compiler is set for the task: {}'.format( task.get_name()))
def get_passport(self, task: Task): template = self.__sched.get_passport_template() template = template.splitlines() if 'mpi' in task.get_compiler().lower(): template = self.__mpi_adapt_passport_template( template, '__NO_MPI__', '__MPI__') else: template = self.__mpi_adapt_passport_template( template, '__MPI__', '__NO_MPI__') template = '\n'.join(template) passport = self.__substitute_template_params(template, task) self.__log_writer.log('PASSPORT:\n{}'.format(passport), level=LogLevel.DEBUG) return passport