Skip to content

Commit e300d5f

Browse files
author
Theofilos Manitaras
committed
Address PR comments (version 2)
1 parent b63c8af commit e300d5f

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

reframe/core/schedulers/__init__.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -222,25 +222,25 @@ def sched_exclusive_access(self):
222222
def prepare(self, commands, environs=None, **gen_opts):
223223
environs = environs or []
224224
if self.num_tasks <= 0:
225-
num_tasks_per_node = (self.num_tasks_per_node if
226-
self.num_tasks_per_node else 1)
227-
min_num_tasks = (abs(self.num_tasks) if self.num_tasks < 0 else
225+
num_tasks_per_node = self.num_tasks_per_node or 1
226+
min_num_tasks = (-self.num_tasks if self.num_tasks else
228227
num_tasks_per_node)
228+
229229
try:
230230
guessed_num_tasks = self.guess_num_tasks()
231-
if guessed_num_tasks >= min_num_tasks:
232-
self._num_tasks = guessed_num_tasks
233-
getlogger().debug('flex_alloc_tasks: setting num_tasks '
234-
'to %s' % self._num_tasks)
235-
else:
236-
raise JobError(
237-
'not enough nodes satisfying the minimum '
238-
'number of tasks required: %s < %s' %
239-
(guessed_num_tasks, min_num_tasks))
240-
241231
except NotImplementedError as e:
242-
raise JobError('guessing number of tasks is not implemented '
243-
'by the backend') from e
232+
raise JobError('flexible task allocation is not supported by '
233+
'this backend') from e
234+
235+
if guessed_num_tasks < min_num_tasks:
236+
raise JobError(
237+
'could not find enough nodes: required %s, found %s' %
238+
(min_num_tasks // num_tasks_per_node,
239+
guessed_num_tasks // num_tasks_per_node))
240+
else:
241+
self._num_tasks = guessed_num_tasks
242+
getlogger().debug('flex_alloc_tasks: setting num_tasks '
243+
'to %s' % self._num_tasks)
244244

245245
with shell.generate_script(self.script_filename,
246246
**gen_opts) as builder:

0 commit comments

Comments
 (0)