|
14 | 14 | from copy import deepcopy
|
15 | 15 | from glob import glob
|
16 | 16 | from logging import INFO
|
| 17 | +import time |
17 | 18 |
|
18 | 19 | from tempfile import mkdtemp
|
19 | 20 |
|
@@ -605,19 +606,32 @@ def _get_inputs(self):
|
605 | 606 | output_value = outputs.dictcopy()[output_name]
|
606 | 607 | logger.debug("output: %s", output_name)
|
607 | 608 |
|
608 |
| - try: |
609 |
| - self.set_input(key, deepcopy(output_value)) |
610 |
| - except traits.TraitError as e: |
| 609 | + traits_err = None |
| 610 | + # input_tries = 1 # Default no reties |
| 611 | + # input_retry_delay = 5 |
| 612 | + # input_retry_exponential_backoff_factor = 1 |
| 613 | + input_tries = self.config["execution"]["input_tries"] |
| 614 | + input_retry_delay = self.config["execution"]["input_retry_delay"] |
| 615 | + input_retry_exp_backoff_factor = self.config["execution"]["input_retry_exp_backoff_factor"] |
| 616 | + for try_n in range(input_tries): |
| 617 | + try: |
| 618 | + self.set_input(key, deepcopy(output_value)) |
| 619 | + break |
| 620 | + except traits.TraitError as e: |
| 621 | + traits_err = e |
| 622 | + if input_tries != 1: |
| 623 | + time.sleep(input_retry_delay*try_n*input_retry_exp_backoff_factor) |
| 624 | + if traits_err is not None: |
611 | 625 | msg = (
|
612 |
| - e.args[0], |
| 626 | + traits_err.args[0], |
613 | 627 | "",
|
614 | 628 | "Error setting node input:",
|
615 | 629 | "Node: %s" % self.name,
|
616 | 630 | "input: %s" % key,
|
617 | 631 | "results_file: %s" % results_fname,
|
618 | 632 | "value: %s" % str(output_value),
|
619 | 633 | )
|
620 |
| - e.args = ("\n".join(msg),) |
| 634 | + traits_err.args = ("\n".join(msg),) |
621 | 635 | raise
|
622 | 636 |
|
623 | 637 | # Successfully set inputs
|
|
0 commit comments