mirror of
https://github.com/paulscherrerinstitute/sf_daq_broker.git
synced 2026-08-04 11:32:25 +02:00
use mod name instead of passed-in name
This commit is contained in:
committed by
Auf keinen Fall Jens
parent
4002f6889b
commit
fbe6ecb882
@@ -249,7 +249,7 @@ class DetectorManager:
|
||||
code = request["code"]
|
||||
|
||||
fn = write_code_to_file(name, code, beamline)
|
||||
func = load_proc_from_file(fn, name)
|
||||
func = load_proc_from_file(fn)
|
||||
test_run(func)
|
||||
|
||||
# commit to git ... or delete and complain
|
||||
@@ -382,13 +382,15 @@ def write_code_to_file(name, code, beamline):
|
||||
return fn
|
||||
|
||||
|
||||
def load_proc_from_file(fn, name):
|
||||
def load_proc_from_file(fn):
|
||||
mod = load_module(fn)
|
||||
|
||||
proc_func_name = "proc"
|
||||
func = getattr(mod, proc_func_name, None) or getattr(mod, name, None)
|
||||
mod_name = mod.__name__
|
||||
|
||||
func = getattr(mod, proc_func_name, None) or getattr(mod, mod_name, None)
|
||||
if func is None:
|
||||
raise AttributeError(f'module "{mod.__name__}" contains neither "{proc_func_name}" nor "{name}" function')
|
||||
raise AttributeError(f'module "{mod_name}" contains neither "{proc_func_name}" nor "{mod_name}" function')
|
||||
|
||||
return func
|
||||
|
||||
|
||||
Reference in New Issue
Block a user