Skip to content

Commit e1dd6fa

Browse files
committed
Removing floats
1 parent 60d40ff commit e1dd6fa

File tree

8 files changed

+45
-45
lines changed

8 files changed

+45
-45
lines changed

tests/compound_job_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@
6868

6969
assert fwa.get_state() == wrench.Action.ActionState.READY, "FileWriteAction1 should be in the READY state"
7070

71-
7271
assert fwa.get_file() == file1, "FileWriteAction1 doesn't have the correct file"
7372
assert fwa.get_file_location() == ss1, "FileWriteAction1 doesn't have the correct file location"
7473
assert not fwa.uses_scratch(), "FileWriteAction1 doesn't have the correct use of scratch"
@@ -82,9 +81,10 @@
8281

8382
assert fra.get_state() == wrench.Action.ActionState.NOT_READY, "FileReadAction1 should be in the READY state"
8483

85-
8684
assert fra.get_file() == file1, "FileReadAction1 doesn't have the correct file"
8785
assert fra.get_file_location() == ss1, "FileReadAction1 doesn't have the correct file location"
86+
print(fra.get_num_bytes_to_read())
87+
print(file1.get_size())
8888
assert fra.get_num_bytes_to_read() == file1.get_size(), "FileReadAction1 doesn't have the correct number of bytes"
8989
assert not fra.uses_scratch(), "FileReadAction1 doesn't have the correct use of scratch"
9090

wrench/cloud_compute_service.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@ def __init__(self, simulation, name: str) -> None:
2828
"""
2929
super().__init__(simulation, name)
3030

31-
def create_vm(self, num_cores: int, ram_memory: float, property_list: dict[str, str],
32-
message_payload_list: dict[str, float]) -> VirtualMachine:
31+
def create_vm(self, num_cores: int, ram_memory: int, property_list: dict[str, str],
32+
message_payload_list: dict[str, int]) -> VirtualMachine:
3333
"""
3434
Create a new virtual machine instance on the compute service
3535
3636
:param num_cores: number of cores in the virtual machine
3737
:type num_cores: int
3838
:param ram_memory: RAM size in bytes
39-
:type ram_memory: float
39+
:type ram_memory: int
4040
:param property_list: a property list ({} means “use all defaults”)
4141
:type property_list: dict
4242
:param message_payload_list: a message payload list ({} means “use all defaults”)

wrench/compound_job.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def get_actions(self) -> List[Action]:
5353
"""
5454
return self.actions
5555

56-
def add_compute_action(self, name: str, flops: float, ram: float,
56+
def add_compute_action(self, name: str, flops: float, ram: int,
5757
max_num_cores: int, min_num_cores: int, parallel_model: Tuple[str, float]) -> ComputeAction:
5858
"""
5959
Add a sleep action to the compound job
@@ -63,7 +63,7 @@ def add_compute_action(self, name: str, flops: float, ram: float,
6363
:param flops: flops associated with this action
6464
:type flops: float
6565
:param ram: minimum amount of ram needed
66-
:type ram: float
66+
:type ram: int
6767
:param min_num_cores: minimum amount of cores this action needs
6868
:type min_num_cores: int
6969
:param max_num_cores: maximum amount of cores this action can use
@@ -119,7 +119,7 @@ def add_file_write_action(self, name: str, file: File, storage_service: StorageS
119119
return self._simulation._add_file_write_action(self, name, file, storage_service)
120120

121121
def add_file_read_action(self, name: str, file: File, storage_service: StorageService,
122-
num_bytes_to_read=0.0) -> FileReadAction:
122+
num_bytes_to_read: int = 0) -> FileReadAction:
123123
"""
124124
Add a file write action to the compound job
125125
@@ -130,7 +130,7 @@ def add_file_read_action(self, name: str, file: File, storage_service: StorageSe
130130
:param storage_service: storage service to write the file to
131131
:type storage_service: StorageService
132132
:param num_bytes_to_read: number of bytes to read in file
133-
:type num_bytes_to_read: float
133+
:type num_bytes_to_read: int
134134
"""
135135
return self._simulation._add_file_read_action(self, name, file, storage_service, num_bytes_to_read)
136136

wrench/compute_action.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class ComputeAction(Action):
1717
WRENCH Action class
1818
"""
1919

20-
def __init__(self, simulation, compound_job: CompoundJob, name: str, flops: float, ram: float, min_num_cores: int,
20+
def __init__(self, simulation, compound_job: CompoundJob, name: str, flops: float, ram: int, min_num_cores: int,
2121
max_num_cores: int, parallel_model: tuple) -> None:
2222
"""
2323
Constructor
@@ -30,7 +30,7 @@ def __init__(self, simulation, compound_job: CompoundJob, name: str, flops: floa
3030
:param flops: amount of flops this action has
3131
:type flops: float
3232
:param ram: minimum amount of ram this action needs
33-
:type ram: float
33+
:type ram: int
3434
:param min_num_cores: minimum amount of cores this action needs
3535
:type min_num_cores: int
3636
:param max_num_cores: maximum amount of cores this action can use
@@ -72,12 +72,12 @@ def get_min_num_cores(self) -> int:
7272
"""
7373
return self.min_num_cores
7474

75-
def get_min_ram_footprint(self) -> float:
75+
def get_min_ram_footprint(self) -> int:
7676
"""
7777
Minimum amount of ram needed for this action
7878
7979
:return: Minimum amount of ram needed
80-
:rtype: float
80+
:rtype: int
8181
"""
8282
return self.ram
8383

wrench/file_read_action.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class FileReadAction(Action):
1818
"""
1919

2020
def __init__(self, simulation, compound_job: CompoundJob, name: str, file: File, storage_service: StorageService,
21-
num_bytes_to_read: float, uses_scratch: bool) -> None:
21+
num_bytes_to_read: int, uses_scratch: bool) -> None:
2222
"""
2323
Constructor
2424
:param simulation: simulation object
@@ -32,7 +32,7 @@ def __init__(self, simulation, compound_job: CompoundJob, name: str, file: File,
3232
:param storage_service: storage service containing file
3333
:type storage_service: StorageService
3434
:param num_bytes_to_read: number of bytes to read
35-
:type num_bytes_to_read: float
35+
:type num_bytes_to_read: int
3636
:param uses_scratch: whether action uses scratch
3737
:type uses_scratch: bool
3838
"""
@@ -61,11 +61,11 @@ def get_file_location(self) -> StorageService:
6161
"""
6262
return self.storage_service
6363

64-
def get_num_bytes_to_read(self) -> float:
64+
def get_num_bytes_to_read(self) -> int:
6565
"""
6666
Get number of bytes to read from file
67-
:return: amount of bytes being read
68-
:rtype: float
67+
:return: number of bytes being read
68+
:rtype: int
6969
"""
7070
return self.num_bytes_to_read
7171

wrench/simulation.py

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -298,10 +298,10 @@ def get_simulated_time(self) -> float:
298298
return response["time"]
299299

300300
def create_bare_metal_compute_service(self, hostname: str,
301-
resources: dict[str, [int, float]],
301+
resources: dict[str, [int, int]],
302302
scratch_space: str,
303303
property_list: dict[str, str],
304-
message_payload_list: dict[str, float]) -> BareMetalComputeService:
304+
message_payload_list: dict[str, int]) -> BareMetalComputeService:
305305
"""
306306
Create a bare metal compute service
307307
@@ -467,7 +467,7 @@ def get_all_hostnames(self) -> List[str]:
467467

468468
def create_workflow_from_json(self, json_object: json, reference_flop_rate: str, ignore_machine_specs: bool,
469469
redundant_dependencies: bool, ignore_cycle_creating_dependencies: bool,
470-
min_cores_per_task: float, max_cores_per_task: float, enforce_num_cores: bool,
470+
min_cores_per_task: int, max_cores_per_task: int, enforce_num_cores: bool,
471471
ignore_avg_cpu: bool, show_warnings: bool) -> Workflow:
472472
"""
473473
Create a workflow from a JSON file
@@ -482,10 +482,10 @@ def create_workflow_from_json(self, json_object: json, reference_flop_rate: str,
482482
:type redundant_dependencies: bool
483483
:param ignore_cycle_creating_dependencies: whether to ignore cycles when creating task dependencies
484484
:type ignore_cycle_creating_dependencies: bool
485-
:param min_cores_per_task: the minimum cores for a task if not specified in the JSON
486-
:type min_cores_per_task: float
487-
:param max_cores_per_task: the maximum cores for a task if not specified in the JSON
488-
:type max_cores_per_task: float
485+
:param min_cores_per_task: the minimum number of cores for a task if not specified in the JSON
486+
:type min_cores_per_task: int
487+
:param max_cores_per_task: the maximum number of cores for a task if not specified in the JSON
488+
:type max_cores_per_task: int
489489
:param enforce_num_cores: whether to enforce the number of cores for a task even if specified in the JSON
490490
:type enforce_num_cores: bool
491491
:param ignore_avg_cpu: whether to ignore the average CPU time information in the JSON to compute
@@ -808,14 +808,14 @@ def _task_get_max_num_cores(self, task: Task) -> int:
808808
return response["max_num_cores"]
809809
raise WRENCHException(response["failure_cause"])
810810

811-
def _task_get_memory(self, task: Task) -> float:
811+
def _task_get_memory(self, task: Task) -> int:
812812
"""
813-
Get the task's memory requirement
813+
Get the task's memory requirement in bytes
814814
:param task: the task
815815
:type task: Task
816816
817817
:return: a memory footprint in bytes
818-
:rtype: float
818+
:rtype: int
819819
820820
:raises WRENCHException: if there is any error in the response
821821
"""
@@ -829,7 +829,7 @@ def _task_get_memory(self, task: Task) -> float:
829829
return response["memory"]
830830
raise WRENCHException(response["failure_cause"])
831831

832-
def _task_get_number_of_children(self, task: Task) -> float:
832+
def _task_get_number_of_children(self, task: Task) -> int:
833833
"""
834834
Get the task's number of children
835835
:param task: the task
@@ -850,7 +850,7 @@ def _task_get_number_of_children(self, task: Task) -> float:
850850
return response["number_of_children"]
851851
raise WRENCHException(response["failure_cause"])
852852

853-
def _task_get_bottom_level(self, task: Task) -> float:
853+
def _task_get_bottom_level(self, task: Task) -> int:
854854
"""
855855
Get the task's bottom-level
856856
:param task: the task
@@ -913,7 +913,7 @@ def _task_get_end_date(self, task: Task) -> float:
913913
return response["time"]
914914
raise WRENCHException(response["failure_cause"])
915915

916-
def _add_compute_action(self, compound_job: CompoundJob, name: str, flops: float, ram: float,
916+
def _add_compute_action(self, compound_job: CompoundJob, name: str, flops: float, ram: int,
917917
max_num_cores: int, min_num_cores: int, parallel_model: tuple) -> Action:
918918
"""
919919
Add a compute action
@@ -924,8 +924,8 @@ def _add_compute_action(self, compound_job: CompoundJob, name: str, flops: float
924924
:type name: str
925925
:param flops: number of flops this action has
926926
:type flops: float
927-
:param ram: amount of ram this action has
928-
:type ram: float
927+
:param ram: amount of ram this action has in bytes
928+
:type ram: int
929929
:param max_num_cores: maximum number of cores this action can have
930930
:type max_num_cores: long
931931
:param min_num_cores: minimum number of cores this action can have
@@ -1076,7 +1076,7 @@ def _add_file_write_action(self, compound_job: CompoundJob, name: str, file: Fil
10761076
raise WRENCHException(response["failure_cause"])
10771077

10781078
def _add_file_read_action(self, compound_job: CompoundJob, name: str, file: File, storage_service: StorageService,
1079-
num_bytes_to_read: float) -> Action:
1079+
num_bytes_to_read: int) -> Action:
10801080
"""
10811081
Add a file read action
10821082
:param compound_job: the action's compound job
@@ -1088,7 +1088,7 @@ def _add_file_read_action(self, compound_job: CompoundJob, name: str, file: File
10881088
:param storage_service: the storage service the file is stored in
10891089
:type storage_service: StorageService
10901090
:param num_bytes_to_read: the number of bytes to read from the file
1091-
:type num_bytes_to_read: float
1091+
:type num_bytes_to_read: int
10921092
:return: the action name
10931093
:rtype: Action
10941094
@@ -1283,17 +1283,17 @@ def _add_parent_job(self, compound_job: CompoundJob, parent_compound_job: Compou
12831283
def _create_vm(self,
12841284
service: CloudComputeService,
12851285
num_cores: int,
1286-
ram_memory: float,
1286+
ram_memory: int,
12871287
property_list: dict[str, str],
1288-
message_payload_list: dict[str, float]) -> VirtualMachine:
1288+
message_payload_list: dict[str, int]) -> VirtualMachine:
12891289
"""
12901290
Create a VM instance
12911291
:param service: the cloud compute service
12921292
:type service: CloudComputeService
12931293
:param num_cores: the number of cores for the VM
12941294
:type num_cores: int
12951295
:param ram_memory: the VM’s RAM memory_manager_service capacity
1296-
:type ram_memory: float
1296+
:type ram_memory: int
12971297
:param property_list: a property list for the CloudComputeService that will run on the VM
12981298
({} means “use all defaults”)
12991299
:type property_list: dict
@@ -1522,7 +1522,7 @@ def _get_core_flop_rates(self, cs: ComputeService) -> Dict[str, float]:
15221522
to_return[response["hostnames"][i]] = response["flop_rates"][i]
15231523
return to_return
15241524

1525-
def _get_core_counts(self, cs: ComputeService) -> Dict[str, float]:
1525+
def _get_core_counts(self, cs: ComputeService) -> Dict[str, int]:
15261526
"""
15271527
Get the map of core counts, keyed by host name
15281528
:param cs: the compute service
@@ -1541,7 +1541,7 @@ def _get_core_counts(self, cs: ComputeService) -> Dict[str, float]:
15411541
return to_return
15421542

15431543
def _workflow_create_task(self, workflow: Workflow, name: str, flops: float, min_num_cores: int, max_num_cores: int,
1544-
memory: float) -> Task:
1544+
memory: int) -> Task:
15451545
"""
15461546
Add a task to the workflow
15471547
:param workflow: the workflow
@@ -1555,7 +1555,7 @@ def _workflow_create_task(self, workflow: Workflow, name: str, flops: float, min
15551555
:param max_num_cores: maximum number of cores
15561556
:type max_num_cores: int
15571557
:param memory: memory requirement in bytes
1558-
:type memory: float
1558+
:type memory: int
15591559
15601560
:return: A task object
15611561
:rtype: Task

wrench/task.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,11 @@ def get_max_num_cores(self) -> int:
117117
"""
118118
return self._simulation._task_get_max_num_cores(self)
119119

120-
def get_memory(self) -> float:
120+
def get_memory(self) -> int:
121121
"""
122122
Get the task's memory requirement
123123
:return: A memory size in bytes
124-
:rtype: float
124+
:rtype: int
125125
"""
126126
return self._simulation._task_get_memory(self)
127127

wrench/workflow.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def __init__(self, simulation: Simulation, name: str) -> None:
3838
self.tasks = {}
3939
super().__init__(simulation, name)
4040

41-
def add_task(self, name: str, flops: float, min_num_cores: int, max_num_cores: int, memory: float) -> Task:
41+
def add_task(self, name: str, flops: float, min_num_cores: int, max_num_cores: int, memory: int) -> Task:
4242
"""
4343
Add a task to the workflow
4444
@@ -51,7 +51,7 @@ def add_task(self, name: str, flops: float, min_num_cores: int, max_num_cores: i
5151
:param max_num_cores: maximum number of cores
5252
:type max_num_cores: int
5353
:param memory: memory requirement in bytes
54-
:type memory: float
54+
:type memory: int
5555
5656
:return: A task object
5757
:rtype: Task

0 commit comments

Comments
 (0)