(*args, **kwargs)
| 134 | |
| 135 | # Capture any exception thrown by the subprocess |
| 136 | def run_fn(*args, **kwargs): |
| 137 | try: |
| 138 | if device_option is None: |
| 139 | fn(*args, **kwargs) |
| 140 | workspace.ResetWorkspace() |
| 141 | else: |
| 142 | with core.DeviceScope(device_option): |
| 143 | fn(*args, **kwargs) |
| 144 | workspace.ResetWorkspace() |
| 145 | except Exception as ex: |
| 146 | queue.put(ex) |
| 147 | |
| 148 | # Start N processes in the background |
| 149 | procs = [] |