Skip to content

Commit 053fa54

Browse files
committed
Apply testing review from Timo
1 parent ef55722 commit 053fa54

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

src/aiida/cmdline/commands/cmd_process.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@
2828
ACTION_TIMEOUT = OverridableOption(
2929
'-t',
3030
'--timeout',
31-
type=click.FLOAT,
31+
type=click.FloatRange(0, float('inf')),
3232
default=float('inf'),
3333
show_default=True,
3434
help='Time in seconds to wait for a response before timing out. '
35-
'If timeout <= 0 the command does not wait for response.',
35+
'If timeout is 0 the command does not wait for response.',
3636
)
3737

3838

src/aiida/engine/processes/control.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ def _perform_actions(
229229

230230
try:
231231
future = action(process.pk, **kwargs)
232+
LOGGER.report(f'Request to {infinitive} Process<{process.pk}> sent.')
232233
except communications.UnroutableError:
233234
LOGGER.error(f'Process<{process.pk}> is unreachable.')
234235
else:
@@ -254,10 +255,15 @@ def _resolve_futures(
254255
:param present: The present tense form of the action verb.
255256
:param timeout: Raise a ``ProcessTimeoutException`` if the process does not respond within this amount of seconds.
256257
"""
257-
if not timeout:
258+
if not timeout or not futures:
259+
if futures:
260+
LOGGER.report(
261+
f"Request to {infinitive} process(es) {','.join([str(proc.pk) for proc in futures.values()])}"
262+
' sent. Skipping waiting for response.'
263+
)
258264
return
259265

260-
LOGGER.report(f"Waiting for process(es) {','.join([str(proc.pk) for proc in futures.values()])}")
266+
LOGGER.report(f"Waiting for process(es) {','.join([str(proc.pk) for proc in futures.values()])}.")
261267

262268
# Ensure that when futures are only are completed if they return an actual value (not a future)
263269
unwrapped_futures = {unwrap_kiwi_future(future): process for future, process in futures.items()}
@@ -273,7 +279,7 @@ def _resolve_futures(
273279
LOGGER.error(f'Failed to {infinitive} Process<{process.pk}>: {exception}')
274280
else:
275281
if result is True:
276-
LOGGER.report(f'Request to {infinitive} Process<{process.pk}> sent')
282+
LOGGER.report(f'Request to {infinitive} Process<{process.pk}> processed.')
277283
elif result is False:
278284
LOGGER.error(f'Problem {present} Process<{process.pk}>')
279285
else:

tests/cmdline/commands/test_process.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ def make_a_builder(sleep_seconds=0):
217217

218218
# practice a normal kill, which should fail
219219
result = run_cli_command(cmd_process.process_kill, [str(node.pk), '--timeout', '1.0'])
220-
assert f'Error: call to kill Process<{node.pk}> timed out' in result.stdout
220+
assert f'Error: Call to kill Process<{node.pk}> timed out' in result.stdout
221221

222222
# force kill the process
223223
result = run_cli_command(cmd_process.process_kill, [str(node.pk), '-F'])

0 commit comments

Comments
 (0)