##// END OF EJS Templates
client.run is now like %run, not TaskClient.run
MinRK -
Show More
@@ -155,9 +155,12 b' class Client(object):'
155 url_or_file : bytes; zmq url or path to ipcontroller-client.json
155 url_or_file : bytes; zmq url or path to ipcontroller-client.json
156 Connection information for the Hub's registration. If a json connector
156 Connection information for the Hub's registration. If a json connector
157 file is given, then likely no further configuration is necessary.
157 file is given, then likely no further configuration is necessary.
158 [Default: None]
158 [Default: use profile]
159 profile : bytes
160 The name of the Cluster profile to be used to find connector information.
161 [Default: 'default']
159 context : zmq.Context
162 context : zmq.Context
160 Pass an existing zmq.Context instance, otherwise the client will create its own
163 Pass an existing zmq.Context instance, otherwise the client will create its own.
161 username : bytes
164 username : bytes
162 set username to be passed to the Session object
165 set username to be passed to the Session object
163 debug : bool
166 debug : bool
@@ -800,23 +803,26 b' class Client(object):'
800 result = self.apply(_execute, (code,), targets=targets, block=self.block, bound=True)
803 result = self.apply(_execute, (code,), targets=targets, block=self.block, bound=True)
801 return result
804 return result
802
805
803 def run(self, code, block=None):
806 def run(self, filename, targets='all', block=None):
804 """Runs `code` on an engine.
807 """Execute contents of `filename` on engine(s).
805
808
806 Calls to this are load-balanced.
809 This simply reads the contents of the file and calls `execute`.
807
808 ``run`` is never `bound` (no effect on engine namespace)
809
810
810 Parameters
811 Parameters
811 ----------
812 ----------
812 code : str
813 filename : str
813 the code string to be executed
814 The path to the file
815 targets : int/str/list of ints/strs
816 the engines on which to execute
817 default : all
814 block : bool
818 block : bool
815 whether or not to wait until done
819 whether or not to wait until done
820 default: self.block
816
821
817 """
822 """
818 result = self.apply(_execute, (code,), targets=None, block=block, bound=False)
823 with open(filename, 'rb') as f:
819 return result
824 code = f.read()
825 return self.execute(code, targets=targets, block=block)
820
826
821 def _maybe_raise(self, result):
827 def _maybe_raise(self, result):
822 """wrapper for maybe raising an exception if apply failed."""
828 """wrapper for maybe raising an exception if apply failed."""
General Comments 0
You need to be logged in to leave comments. Login now