Show More
@@ -67,7 +67,7 b' def defaultblock(f, self, *args, **kwargs):' | |||||
67 | self.block = saveblock |
|
67 | self.block = saveblock | |
68 | return ret |
|
68 | return ret | |
69 |
|
69 | |||
70 | def remote(client, block=None, targets=None): |
|
70 | def remote(client, bound=False, block=None, targets=None): | |
71 | """Turn a function into a remote function. |
|
71 | """Turn a function into a remote function. | |
72 |
|
72 | |||
73 | This method can be used for map: |
|
73 | This method can be used for map: | |
@@ -76,7 +76,7 b' def remote(client, block=None, targets=None):' | |||||
76 | def func(a) |
|
76 | def func(a) | |
77 | """ |
|
77 | """ | |
78 | def remote_function(f): |
|
78 | def remote_function(f): | |
79 | return RemoteFunction(client, f, block, targets) |
|
79 | return RemoteFunction(client, f, bound, block, targets) | |
80 | return remote_function |
|
80 | return remote_function | |
81 |
|
81 | |||
82 | #-------------------------------------------------------------------------- |
|
82 | #-------------------------------------------------------------------------- | |
@@ -86,15 +86,16 b' def remote(client, block=None, targets=None):' | |||||
86 | class RemoteFunction(object): |
|
86 | class RemoteFunction(object): | |
87 | """Turn an existing function into a remote function""" |
|
87 | """Turn an existing function into a remote function""" | |
88 |
|
88 | |||
89 | def __init__(self, client, f, block=None, targets=None): |
|
89 | def __init__(self, client, f, bound=False, block=None, targets=None): | |
90 | self.client = client |
|
90 | self.client = client | |
91 | self.func = f |
|
91 | self.func = f | |
92 | self.block=block |
|
92 | self.block=block | |
|
93 | self.bound=bound | |||
93 | self.targets=targets |
|
94 | self.targets=targets | |
94 |
|
95 | |||
95 | def __call__(self, *args, **kwargs): |
|
96 | def __call__(self, *args, **kwargs): | |
96 | return self.client.apply(self.func, args=args, kwargs=kwargs, |
|
97 | return self.client.apply(self.func, args=args, kwargs=kwargs, | |
97 | block=self.block, targets=self.targets) |
|
98 | block=self.block, targets=self.targets, bound=self.bound) | |
98 |
|
99 | |||
99 |
|
100 | |||
100 | class AbortedTask(object): |
|
101 | class AbortedTask(object): |
General Comments 0
You need to be logged in to leave comments.
Login now