|
21 | 21 | from logging import Logger |
22 | 22 | from typing import Dict, Optional, List, Set, Tuple, Type, Union |
23 | 23 |
|
24 | | -from numpy import isin |
25 | | - |
26 | 24 | from ..common import File, FileLink, Task, Workflow |
27 | 25 |
|
28 | 26 | from ..wfchef.wfchef_abstract_recipe import WfChefWorkflowRecipe |
@@ -126,23 +124,28 @@ def create_benchmark_from_synthetic_workflow( |
126 | 124 |
|
127 | 125 | cores, lock = self._creating_lock_files(lock_files_folder) |
128 | 126 |
|
129 | | - max_runtime = max(task.runtime for task in self.workflow.tasks.values()) |
| 127 | + task_max_runtimes = {} |
| 128 | + for task in self.workflow.tasks.values(): |
| 129 | + if task.category not in task_max_runtimes or task.runtime > task_max_runtimes[task.category]: |
| 130 | + task_max_runtimes[task.category] = task.runtime |
| 131 | + max_runtime = max(runtime for runtime in task_max_runtimes.values()) |
| 132 | + |
130 | 133 | for task in self.workflow.tasks.values(): |
131 | | - # scale argument parameters to achieve a runtime distribution |
132 | 134 | runtime_factor = task.runtime / max_runtime |
133 | | - task_percent_cpu = percent_cpu[task.category] if isinstance(percent_cpu, dict) else percent_cpu |
134 | | - task_percent_cpu *= runtime_factor |
135 | | - if cpu_work: |
136 | | - task_cpu_work = cpu_work[task.category] if isinstance(cpu_work, dict) else cpu_work |
137 | | - task_cpu_work = int(task_cpu_work * runtime_factor) if task_cpu_work else None |
| 135 | + task_runtime_factor = task.runtime / task_max_runtimes[task.category] |
| 136 | + # scale argument parameters to achieve a runtime distribution |
| 137 | + task_percent_cpu = percent_cpu[task.category] * task_runtime_factor if isinstance(percent_cpu, dict) else percent_cpu * runtime_factor |
| 138 | + if cpu_work is not None: |
| 139 | + task_cpu_work = cpu_work[task.category] * task_runtime_factor if isinstance(cpu_work, dict) else cpu_work * runtime_factor |
| 140 | + task_cpu_work = int(task_cpu_work) |
138 | 141 | else: |
139 | 142 | task_cpu_work = None |
140 | | - if gpu_work: |
141 | | - task_gpu_work = gpu_work[task.category] if isinstance(gpu_work, dict) else gpu_work |
142 | | - task_gpu_work *= runtime_factor |
| 143 | + if gpu_work is not None: |
| 144 | + task_gpu_work = gpu_work[task.category] * task_runtime_factor if isinstance(gpu_work, dict) else gpu_work * runtime_factor |
| 145 | + task_gpu_work = int(task_gpu_work) |
143 | 146 | else: |
144 | 147 | task_gpu_work = None |
145 | | - task_memory = int(mem * runtime_factor) if mem else None |
| 148 | + task_memory = mem * runtime_factor if mem else None |
146 | 149 | self._set_argument_parameters( |
147 | 150 | task, |
148 | 151 | task_percent_cpu, |
@@ -177,8 +180,8 @@ def create_benchmark_from_synthetic_workflow( |
177 | 180 | f"Creating {str(file_path)} ({file.size} bytes) ... file {i+1} out of {len(workflow_input_files)}", |
178 | 181 | end='\r' |
179 | 182 | ) |
180 | | - with open(file_path, 'wb') as fp: |
181 | | - fp.write(os.urandom(int(file.size))) |
| 183 | + with open(save_dir.joinpath("to_create.txt"), "a+") as fp: |
| 184 | + fp.write(f"{file.name} {file.size}\n") |
182 | 185 | self.logger.debug(f"Created file: {str(file_path)}") |
183 | 186 |
|
184 | 187 | self.logger.info(f"Saving benchmark workflow: {json_path}") |
|
0 commit comments