Skip to content

Commit

Permalink
Adapter: Submit Memory Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
calvinp0 committed Mar 18, 2024
1 parent 90a5c89 commit dfdcf13
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions arc/job/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -772,13 +772,13 @@ def set_cpu_and_mem(self):
f'exceeds {100 * job_max_server_node_memory_allocation}% of the the maximum node memory on '
f'{self.server}. Setting it to {job_max_server_node_memory_allocation * max_mem:.2f} GB.')
self.job_memory_gb = job_max_server_node_memory_allocation * max_mem
total_submit_script_memory = self.job_memory_gb * 1024 * 1.05 if (self.job_memory_gb * 1024 * 1.05) <= max_mem else max_mem * 1000 # MB
total_submit_script_memory = self.job_memory_gb * 1024 * 1.05 if (self.job_memory_gb * 1024 * 1.05) <= (max_mem * 1024) else max_mem * 1024 # MB
self.job_status[1]['keywords'].append('max_total_job_memory') # Useful info when troubleshooting.
else:
if max_mem is None:
total_submit_script_memory = self.job_memory_gb * 1024 * 1.1
else:
total_submit_script_memory = self.job_memory_gb * 1024 * 1.1 if (self.job_memory_gb * 1024 * 1.1) <= max_mem else max_mem * 1000 # MB
total_submit_script_memory = self.job_memory_gb * 1024 * 1.1 if (self.job_memory_gb * 1024 * 1.1) <= (max_mem * 1024) else max_mem * 1024 # MB
# Determine amount of memory in submit script based on cluster job scheduling system.
cluster_software = servers[self.server].get('cluster_soft').lower() if self.server is not None else None
if cluster_software in ['oge', 'sge', 'htcondor']:
Expand Down
2 changes: 1 addition & 1 deletion arc/job/adapter_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ def test_set_cpu_and_mem(self):
self.job_4.cpu_cores = None
self.job_4.set_cpu_and_mem()
self.assertEqual(self.job_4.cpu_cores, 8)
expected_memory = math.ceil((14 * 1024 * 1.1) / self.job_4.cpu_cores)
expected_memory = math.ceil((14 * 1024 * 1.1))
self.assertEqual(self.job_4.submit_script_memory, expected_memory)
self.job_4.server = 'local'

Expand Down

0 comments on commit dfdcf13

Please sign in to comment.