44from IPython .core .error import UsageError
55from IPython .core .magic import Magics , line_cell_magic , magics_class , needs_local_scope
66
7- from ._core import Run , run
7+ from ._core import Run , get , run
88from ._where import Where , remotely
99
1010
@@ -16,14 +16,17 @@ def afar(self, line, cell=None, *, local_ns):
1616 """Execute the cell on a dask.distributed cluster.
1717
1818 Usage, in line mode:
19- %afar [-r run -d data -w where -c client] code_to_run
19+ %afar [-g - r run -d data -w where -c client] code_to_run
2020 Usage, in cell mode
21- %%afar [-r run -d data -w where -c client <variable_names>]
21+ %%afar [-g - r run -d data -w where -c client <variable_names>]
2222 code...
2323 code...
2424
2525 Options:
2626
27+ -g/--get
28+ Get results as values, not as futures. This uses `afar.get` instead of `afar.run`.
29+
2730 -r/--run <run>
2831 A `Run` object from the local namespace such as `run = afar.run(data=mydata)`
2932
@@ -55,7 +58,8 @@ def afar(self, line, cell=None, *, local_ns):
5558 """
5659 opts , line = self .parse_options (
5760 line ,
58- "r:d:w:c:" ,
61+ "gr:d:w:c:" ,
62+ "get" ,
5963 "run=" ,
6064 "data=" ,
6165 "where=" ,
@@ -81,6 +85,8 @@ def afar(self, line, cell=None, *, local_ns):
8185 raise UsageError (f"Variable name { runner !r} for -r or --run { not_found } " )
8286 if not isinstance (runner , Run ):
8387 raise UsageError (f"-r or --run argument must be of type Run; got: { type (runner )} " )
88+ elif "g" in opts or "get" in opts :
89+ runner = get ()
8490 else :
8591 runner = run ()
8692 client = runner .client
0 commit comments