diff --git a/snudda/detect/detect.py b/snudda/detect/detect.py index 4163912ce..7e005de95 100644 --- a/snudda/detect/detect.py +++ b/snudda/detect/detect.py @@ -2616,15 +2616,23 @@ def setup_parallel(self, d_view=None): try: with d_view.sync_imports(): from snudda.detect.detect import SnuddaDetect - + except Exception as e: self.write_log("Error during sync_imports:") self.write_log(str(e)) - worker_errors = d_view.apply_sync(lambda: str(e)).values() - - for engine_id, error in enumerate(worker_errors): - self.write_log(f"Engine {engine_id}: {error}") + cmd_errorstr = """ +import os +import traceback +import uuid +import traceback + +tstr = traceback.format_exc() +tmp = open(os.path.join(f"worker-error-file-{uuid.uuid4()}"), 'w') +tmp.write(f"Exception: {tstr}") +tmp.close() +""" + d_view.execute(cmd_errorstr, block=True) raise # Re-raise the exception to stop the job