forked from M-Labs/artiq
protocols/remote_exec: give access to controller_initial_namespace
This commit is contained in:
parent
69516136c4
commit
059836c591
|
@ -10,6 +10,8 @@ __all__ = ["RemoteExecServer", "RemoteExecClient", "simple_rexec_server_loop"]
|
|||
class RemoteExecServer:
|
||||
def __init__(self, initial_namespace):
|
||||
self.namespace = dict(initial_namespace)
|
||||
# The module actually has to exist, otherwise it breaks e.g. Numba
|
||||
self.namespace["__name__"] = "artiq.protocols.remote_exec"
|
||||
|
||||
def add_code(self, code):
|
||||
exec(code, self.namespace)
|
||||
|
@ -21,6 +23,7 @@ class RemoteExecServer:
|
|||
def simple_rexec_server_loop(target_name, target, host, port,
|
||||
description=None):
|
||||
initial_namespace = {"controller_driver": target}
|
||||
initial_namespace["controller_initial_namespace"] = initial_namespace
|
||||
targets = {
|
||||
target_name: target,
|
||||
target_name + "_rexec": lambda: RemoteExecServer(initial_namespace)
|
||||
|
|
Loading…
Reference in New Issue