mirror of https://github.com/m-labs/artiq.git
worker: restore sys.modules in examine() (#976)
This commit is contained in:
parent
8d66d53e06
commit
8c69d939fb
|
@ -4,6 +4,7 @@ import os
|
||||||
import logging
|
import logging
|
||||||
import traceback
|
import traceback
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
from copy import copy
|
||||||
|
|
||||||
import h5py
|
import h5py
|
||||||
|
|
||||||
|
@ -152,7 +153,11 @@ class ExamineDatasetMgr:
|
||||||
|
|
||||||
|
|
||||||
def examine(device_mgr, dataset_mgr, file):
|
def examine(device_mgr, dataset_mgr, file):
|
||||||
|
previous_modules = copy(sys.modules)
|
||||||
|
try:
|
||||||
module = file_import(file)
|
module = file_import(file)
|
||||||
|
finally:
|
||||||
|
sys.modules = previous_modules
|
||||||
for class_name, exp_class in module.__dict__.items():
|
for class_name, exp_class in module.__dict__.items():
|
||||||
if class_name[0] == "_":
|
if class_name[0] == "_":
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in New Issue