From 8c69d939fb5b4df15546dced9faa128931bf2736 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Wed, 2 May 2018 12:32:35 +0800 Subject: [PATCH] worker: restore sys.modules in examine() (#976) --- artiq/master/worker_impl.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/artiq/master/worker_impl.py b/artiq/master/worker_impl.py index 3d6153603..4aec04afb 100644 --- a/artiq/master/worker_impl.py +++ b/artiq/master/worker_impl.py @@ -4,6 +4,7 @@ import os import logging import traceback from collections import OrderedDict +from copy import copy import h5py @@ -152,7 +153,11 @@ class ExamineDatasetMgr: def examine(device_mgr, dataset_mgr, file): - module = file_import(file) + previous_modules = copy(sys.modules) + try: + module = file_import(file) + finally: + sys.modules = previous_modules for class_name, exp_class in module.__dict__.items(): if class_name[0] == "_": continue