(self, done)
| 57 | time.sleep(1) |
| 58 | |
| 59 | def process_remote(self, done): |
| 60 | time.sleep(0.05) # file upload |
| 61 | |
| 62 | self.remote_task = OdmTaskMock(nonloc.remote_queue <= MAX_QUEUE, nonloc.remote_queue) |
| 63 | self.params['tasks'].append(self.remote_task) |
| 64 | |
| 65 | if nonloc.should_fail: |
| 66 | if self.project_path.endswith("0006"): |
| 67 | raise exceptions.TaskFailedError("FAIL #6") |
| 68 | |
| 69 | nonloc.remote_queue += 1 |
| 70 | |
| 71 | # Upload successful |
| 72 | done(error=None, partial=True) |
| 73 | |
| 74 | # Async processing |
| 75 | def monitor(): |
| 76 | try: |
| 77 | if nonloc.task_limit_reached and random.randint(0, 4) == 0: |
| 78 | nonloc.remote_queue -= 1 |
| 79 | raise NodeTaskLimitReachedException("Random fail!") |
| 80 | |
| 81 | if not nonloc.task_limit_reached and self.remote_task.queue_num > MAX_QUEUE: |
| 82 | nonloc.remote_queue -= 1 |
| 83 | nonloc.task_limit_reached = True |
| 84 | raise NodeTaskLimitReachedException("Delayed task limit reached") |
| 85 | time.sleep(0.5) |
| 86 | nonloc.remote_queue -= 1 |
| 87 | done() |
| 88 | except Exception as e: |
| 89 | done(e) |
| 90 | |
| 91 | t = threading.Thread(target=monitor) |
| 92 | self.params['threads'].append(t) |
| 93 | t.start() |
| 94 | |
| 95 | self.lre.run(TaskMock) |
| 96 | self.assertTrue(nonloc.local_task_check) |
nothing calls this directly
no test coverage detected