Skip to content
Snippets Groups Projects

SW-824: Resolve SW-824

Merged Jorrit Schaap requested to merge SW-824 into LOFAR-Release-4_0
1 file
+ 4
5
Compare changes
  • Side-by-side
  • Inline
  • d6efc8f4
    SW-824: processed review comments, better way of input checking. · d6efc8f4
    Jorrit Schaap authored
@@ -123,23 +123,22 @@ def get_cep4_slurm_nodes(states, partition: str) -> []:
try:
# filter out unknown states
_states = [s for s in states if s in SLURM_STATES]
if not _states:
if any(s for s in states if s not in SLURM_STATES):
raise ValueError("the given states:%s are not valid slurm states:%s" % (states, SLURM_STATES))
if partition not in SLURM_PARTITIONS:
raise ValueError("the given partition:%s is not one of the valid cep4 slurm partition:%s" % (partition, SLURM_PARTITIONS))
logger.debug('determining available cep4 nodes states:%s, partition:%s', _states, partition)
logger.debug('determining available cep4 nodes states:%s, partition:%s', states, partition)
# find out which nodes are available
cmd = ['sinfo -p %s -t %s' % (partition, ','.join(_states))]
cmd = ['sinfo -p %s -t %s' % (partition, ','.join(states))]
cmd = wrap_command_in_cep4_head_node_ssh_call(cmd)
logger.debug('executing command: %s', ' '.join(cmd))
out = check_output_returning_strings(cmd)
lines = out.split('\n')
for state in _states:
for state in states:
try:
line = next(l for l in lines if state in l).strip()
# get nodes string part of line:
Loading