roryk / ipython-cluster-helper

Tool to easily start up an IPython cluster on different schedulers.
148 stars 23 forks source link

Calling cluster_view from within another python file #48

Open GarrettBeatty opened 7 years ago

GarrettBeatty commented 7 years ago

If I have the following code:

def run():
    with cluster_view(scheduler=None, queue=None, num_jobs=5, direct=True,
                    extra_params={"run_local": True}) as view:
        a = 1
        view.push({'a':a})
        test = view.map(some_function, range(20))

When I call run from within another Python file I get an error.. NameError: name 'a' is not defined. This code will work if I just call run() within the same file.