##// 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 155 url_or_file : bytes; zmq url or path to ipcontroller-client.json
156 156 Connection information for the Hub's registration. If a json connector
157 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 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 164 username : bytes
162 165 set username to be passed to the Session object
163 166 debug : bool
@@ -800,23 +803,26 b' class Client(object):'
800 803 result = self.apply(_execute, (code,), targets=targets, block=self.block, bound=True)
801 804 return result
802 805
803 def run(self, code, block=None):
804 """Runs `code` on an engine.
806 def run(self, filename, targets='all', block=None):
807 """Execute contents of `filename` on engine(s).
805 808
806 Calls to this are load-balanced.
807
808 ``run`` is never `bound` (no effect on engine namespace)
809 This simply reads the contents of the file and calls `execute`.
809 810
810 811 Parameters
811 812 ----------
812 code : str
813 the code string to be executed
813 filename : str
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 818 block : bool
815 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)
819 return result
823 with open(filename, 'rb') as f:
824 code = f.read()
825 return self.execute(code, targets=targets, block=block)
820 826
821 827 def _maybe_raise(self, result):
822 828 """wrapper for maybe raising an exception if apply failed."""
General Comments 0
You need to be logged in to leave comments. Login now