|
24 | 24 | from aiida.common.datastructures import CalcJobState |
25 | 25 | from aiida.common.exceptions import FeatureNotAvailable, TransportTaskException |
26 | 26 | from aiida.common.folders import SandboxFolder |
| 27 | +from aiida.engine import utils |
27 | 28 | from aiida.engine.daemon import execmanager |
28 | 29 | from aiida.engine.processes.exit_code import ExitCode |
29 | 30 | from aiida.engine.transports import TransportQueue |
30 | | -from aiida.engine.utils import InterruptableFuture, exponential_backoff_retry, interruptable_task |
| 31 | +from aiida.engine.utils import InterruptableFuture, interruptable_task |
31 | 32 | from aiida.manage.configuration import get_config_option |
32 | 33 | from aiida.orm.nodes.process.calculation.calcjob import CalcJobNode |
33 | 34 | from aiida.schedulers.datastructures import JobState |
@@ -102,7 +103,7 @@ async def do_upload(): |
102 | 103 | try: |
103 | 104 | logger.info(f'scheduled request to upload CalcJob<{node.pk}>') |
104 | 105 | ignore_exceptions = (plumpy.futures.CancelledError, PreSubmitException, plumpy.process_states.Interruption) |
105 | | - skip_submit = await exponential_backoff_retry( |
| 106 | + skip_submit = await utils.exponential_backoff_retry( |
106 | 107 | do_upload, initial_interval, max_attempts, logger=node.logger, ignore_exceptions=ignore_exceptions |
107 | 108 | ) |
108 | 109 | except PreSubmitException: |
@@ -150,7 +151,7 @@ async def do_submit(): |
150 | 151 | try: |
151 | 152 | logger.info(f'scheduled request to submit CalcJob<{node.pk}>') |
152 | 153 | ignore_exceptions = (plumpy.futures.CancelledError, plumpy.process_states.Interruption) |
153 | | - result = await exponential_backoff_retry( |
| 154 | + result = await utils.exponential_backoff_retry( |
154 | 155 | do_submit, initial_interval, max_attempts, logger=node.logger, ignore_exceptions=ignore_exceptions |
155 | 156 | ) |
156 | 157 | except (plumpy.futures.CancelledError, plumpy.process_states.Interruption): |
@@ -208,7 +209,7 @@ async def do_update(): |
208 | 209 | try: |
209 | 210 | logger.info(f'scheduled request to update CalcJob<{node.pk}>') |
210 | 211 | ignore_exceptions = (plumpy.futures.CancelledError, plumpy.process_states.Interruption) |
211 | | - job_done = await exponential_backoff_retry( |
| 212 | + job_done = await utils.exponential_backoff_retry( |
212 | 213 | do_update, initial_interval, max_attempts, logger=node.logger, ignore_exceptions=ignore_exceptions |
213 | 214 | ) |
214 | 215 | except (plumpy.futures.CancelledError, plumpy.process_states.Interruption): |
@@ -258,7 +259,7 @@ async def do_monitor(): |
258 | 259 | try: |
259 | 260 | logger.info(f'scheduled request to monitor CalcJob<{node.pk}>') |
260 | 261 | ignore_exceptions = (plumpy.futures.CancelledError, plumpy.process_states.Interruption) |
261 | | - monitor_result = await exponential_backoff_retry( |
| 262 | + monitor_result = await utils.exponential_backoff_retry( |
262 | 263 | do_monitor, initial_interval, max_attempts, logger=node.logger, ignore_exceptions=ignore_exceptions |
263 | 264 | ) |
264 | 265 | except (plumpy.futures.CancelledError, plumpy.process_states.Interruption): |
@@ -326,7 +327,7 @@ async def do_retrieve(): |
326 | 327 | try: |
327 | 328 | logger.info(f'scheduled request to retrieve CalcJob<{node.pk}>') |
328 | 329 | ignore_exceptions = (plumpy.futures.CancelledError, plumpy.process_states.Interruption) |
329 | | - result = await exponential_backoff_retry( |
| 330 | + result = await utils.exponential_backoff_retry( |
330 | 331 | do_retrieve, initial_interval, max_attempts, logger=node.logger, ignore_exceptions=ignore_exceptions |
331 | 332 | ) |
332 | 333 | except (plumpy.futures.CancelledError, plumpy.process_states.Interruption): |
@@ -371,7 +372,7 @@ async def do_stash(): |
371 | 372 | return await execmanager.stash_calculation(node, transport) |
372 | 373 |
|
373 | 374 | try: |
374 | | - await exponential_backoff_retry( |
| 375 | + await utils.exponential_backoff_retry( |
375 | 376 | do_stash, |
376 | 377 | initial_interval, |
377 | 378 | max_attempts, |
@@ -419,7 +420,7 @@ async def do_kill(): |
419 | 420 |
|
420 | 421 | try: |
421 | 422 | logger.info(f'scheduled request to kill CalcJob<{node.pk}>') |
422 | | - result = await exponential_backoff_retry(do_kill, initial_interval, max_attempts, logger=node.logger) |
| 423 | + result = await utils.exponential_backoff_retry(do_kill, initial_interval, max_attempts, logger=node.logger) |
423 | 424 | except plumpy.process_states.Interruption: |
424 | 425 | raise |
425 | 426 | except Exception as exception: |
|
0 commit comments