|
7 | 7 | # the Free Software Foundation, either version 3 of the License, or |
8 | 8 | # (at your option) any later version. |
9 | 9 |
|
| 10 | +import sys |
10 | 11 | import atexit |
11 | 12 | import json |
12 | 13 | import pathlib |
@@ -262,7 +263,7 @@ def add_file(self, name: str, size: int) -> File: |
262 | 263 |
|
263 | 264 | response = r.json() |
264 | 265 | if response["wrench_api_request_success"]: |
265 | | - new_file = File(self, name) |
| 266 | + new_file = File(self, name, size) |
266 | 267 | self.files[name] = new_file |
267 | 268 | return new_file |
268 | 269 | raise WRENCHException(response["failure_cause"]) |
@@ -509,20 +510,35 @@ def create_workflow_from_json(self, json_object: json, reference_flop_rate: str, |
509 | 510 | "ignore_avg_cpu": ignore_avg_cpu, |
510 | 511 | "show_warnings": show_warnings} |
511 | 512 |
|
| 513 | + sys.stderr.write("HERE\n") |
| 514 | + |
512 | 515 | r = self.__send_request_to_daemon(requests.post, f"{self.daemon_url}/{self.simid}/createWorkflowFromJSON", |
513 | 516 | json_data=data) |
514 | 517 | response = r.json() |
515 | 518 |
|
516 | 519 | # Create the workflow |
517 | 520 | workflow = Workflow(self, response["workflow_name"]) |
518 | 521 |
|
| 522 | + sys.stderr.write("CREATING TASKS\n") |
519 | 523 | # Create the tasks |
520 | | - for task_name in response["tasks"]: |
521 | | - workflow.tasks[task_name] = Task(self, workflow, task_name) |
| 524 | + for task_spec in response["tasks"]: |
| 525 | + task_name = task_spec["name"] |
| 526 | + task_flops = task_spec["flops"] |
| 527 | + task_min_num_cores = task_spec["min_num_cores"] |
| 528 | + task_max_num_cores = task_spec["max_num_cores"] |
| 529 | + task_memory = task_spec["memory"] |
| 530 | + workflow.tasks[task_name] = Task(self, workflow, task_name, task_flops, task_min_num_cores, task_max_num_cores, task_memory) |
| 531 | + |
522 | 532 |
|
523 | 533 | # Create the files |
524 | | - for file_name in response["files"]: |
525 | | - self.files[file_name] = File(self, file_name) |
| 534 | + sys.stderr.write("CREATING FILES\n") |
| 535 | + print(response["files"]) |
| 536 | + for file_spec in response["files"]: |
| 537 | + file_name = file_spec["name"] |
| 538 | + file_size = file_spec["size"] |
| 539 | + sys.stderr.write(f"---> {file_name}: {file_size}\n") |
| 540 | + self.files[file_name] = File(self, file_name, file_size) |
| 541 | + sys.stderr.write("CREATED FILES\n") |
526 | 542 |
|
527 | 543 | return workflow |
528 | 544 |
|
@@ -1572,7 +1588,7 @@ def _workflow_create_task(self, workflow: Workflow, name: str, flops: float, min |
1572 | 1588 |
|
1573 | 1589 | response = r.json() |
1574 | 1590 | if response["wrench_api_request_success"]: |
1575 | | - workflow.tasks[name] = Task(self, workflow, name) |
| 1591 | + workflow.tasks[name] = Task(self, workflow, name, flops, min_num_cores, max_num_cores, memory) |
1576 | 1592 | return workflow.tasks[name] |
1577 | 1593 | raise WRENCHException(response["failure_cause"]) |
1578 | 1594 |
|
|
0 commit comments