Exemple #1
0
    def __extract_path_files_and_zip_res(self, task: Task, zip_name: str):
        path = task.get_dir_name_for_task(self.workdir)

        if not os.path.exists(path):
            raise RuntimeError(
                'Cannot get files for task {}. No directory is present for this task.'
                .format(task.get_name()))

        files = os.listdir(path)
        zip_res = os.path.join(path, zip_name)
        return path, files, zip_res
Exemple #2
0
    async def handle_compilation(self, task: Task, args: list):
        task.set_bin_name(
            os.path.join(task.path_to_task_bin(self.__workdir),
                         task.get_name() + '.out'))

        compilation_commands = self.__get_compile_cmds(task, args)

        compilation_output = await self.__executor.async_exec_cmds_with_wrapping(
            commands=compilation_commands,
            dir_to_use=task.path_to_task_bin(self.__workdir),
        )

        compilation_log_file = os.path.join(
            task.get_dir_name_for_task(self.__workdir), 'compilation.log')
        with open(compilation_log_file, 'w') as output_file:
            output_file.write(compilation_output)

        return
Exemple #3
0
    def __init_templ_dct(self, templ_dct, task: Task):
        """
        Function to initialize template dictionary with methods of the related Task object

        :param task: related task
        :return: nothing
        """
        templ_dct['__procnum__'] = task.get_procnum()
        templ_dct['__walltime__'] = task.get_walltime()
        templ_dct['__memory__'] = task.get_memory()
        templ_dct['__filename__'] = task.get_filename()
        templ_dct['__descname__'] = task.get_passport_name()
        templ_dct['__jobid__'] = task.get_jobid()
        templ_dct['__name__'] = task.get_name()
        templ_dct['__user__'] = task.get_user()
        templ_dct['__taskdir__'] = task.get_dir_name_for_task(self.workdir)
        templ_dct['__binname__'] = task.get_bin_name()
        templ_dct['__logname__'] = task.get_log_name()
        templ_dct['__workdir__'] = self.__get_workdir()