Skip to content

Commit 8c7a833

Browse files
author
Johannes Otepka
committed
'task_label' renamed to 'label'
1 parent 161a987 commit 8c7a833

File tree

5 files changed

+23
-23
lines changed

5 files changed

+23
-23
lines changed

docs/source/examples/basic_task_label.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,24 +24,24 @@ def wait(t):
2424
# use load balanced view
2525
dview = rc.load_balanced_view()
2626
ar_list = [
27-
dview.map_async(wait, [2], task_label=f"task_label_{i:02}") for i in range(10)
27+
dview.map_async(wait, [2], label=f"mylabel_{i:02}") for i in range(10)
2828
]
2929
dview.wait(ar_list)
3030
else:
3131
# use direct view
3232
dview = rc[:]
3333
ar_list = [
34-
dview.apply_async(wait, 2, task_label=f"task_label_{i:02}") for i in range(10)
34+
dview.apply_async(wait, 2, label=f"mylabel_{i:02}") for i in range(10)
3535
]
3636
dview.wait(ar_list)
3737

3838
# query database
3939
data = rc.db_query(
40-
{'task_label': {"$nin": ""}}, keys=['msg_id', 'task_label', 'engine_uuid']
40+
{'label': {"$nin": ""}}, keys=['msg_id', 'label', 'engine_uuid']
4141
)
4242
for d in data:
4343
print(
44-
f"msg_id={d['msg_id']}; task_label={d['task_label']}; engine_uuid={d['engine_uuid']}"
44+
f"msg_id={d['msg_id']}; label={d['label']}; engine_uuid={d['engine_uuid']}"
4545
)
4646

4747
cluster.stop_cluster_sync()

ipyparallel/client/remotefunction.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,14 +195,14 @@ def __init__(
195195
chunksize=None,
196196
ordered=True,
197197
return_exceptions=False,
198-
task_label=None,
198+
label=None,
199199
**flags,
200200
):
201201
super().__init__(view, f, block=block, **flags)
202202
self.chunksize = chunksize
203203
self.ordered = ordered
204204
self.return_exceptions = return_exceptions
205-
self.task_label = task_label
205+
self.label = label
206206

207207
mapClass = Map.dists[dist]
208208
self.mapObject = mapClass()
@@ -296,8 +296,8 @@ def __call__(self, *sequences, **kwargs):
296296
view = self.view if balanced else client[t]
297297
with view.temp_flags(block=False, **self.flags):
298298
ar = view.apply(
299-
f, *args, task_label=self.task_label
300-
) # is this the right place to insert the task_label?
299+
f, *args, label=self.label
300+
) # is this the right place to insert the label?
301301
ar.owner = False
302302

303303
msg_id = ar.msg_ids[0]

ipyparallel/client/view.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -566,10 +566,10 @@ def _really_apply(
566566
_idents, _targets = self.client._build_targets(targets)
567567
futures = []
568568

569-
task_label = (
570-
kwargs.pop("task_label") if "task_label" in kwargs else None
571-
) # is this the correct/best way of retieving task_label?
572-
metadata = dict(task_label=task_label)
569+
label = (
570+
kwargs.pop("label") if "label" in kwargs else None
571+
) # is this the correct/best way of retieving label?
572+
metadata = dict(label=label)
573573

574574
pf = PrePickled(f)
575575
pargs = [PrePickled(arg) for arg in args]
@@ -610,7 +610,7 @@ def map(
610610
block=None,
611611
track=False,
612612
return_exceptions=False,
613-
task_label=None,
613+
label=None,
614614
):
615615
"""Parallel version of builtin `map`, using this View's `targets`.
616616
@@ -1062,7 +1062,7 @@ def map(
10621062
block=None,
10631063
track=False,
10641064
return_exceptions=False,
1065-
task_label=None,
1065+
label=None,
10661066
):
10671067
"""Parallel version of builtin `map`, using this View's `targets`.
10681068
@@ -1382,9 +1382,9 @@ def _really_apply(
13821382
# ensure *not* bytes
13831383
idents = [ident.decode() for ident in idents]
13841384

1385-
task_label = (
1386-
kwargs.pop("task_label") if "task_label" in kwargs else None
1387-
) # is this the correct/best way of retieving task_label?
1385+
label = (
1386+
kwargs.pop("label") if "label" in kwargs else None
1387+
) # is this the correct/best way of retieving label?
13881388

13891389
after = self._render_dependency(after)
13901390
follow = self._render_dependency(follow)
@@ -1394,7 +1394,7 @@ def _really_apply(
13941394
timeout=timeout,
13951395
targets=idents,
13961396
retries=retries,
1397-
task_label=task_label,
1397+
label=label,
13981398
)
13991399

14001400
future = self.client.send_apply_request(
@@ -1425,7 +1425,7 @@ def map(
14251425
chunksize=1,
14261426
ordered=True,
14271427
return_exceptions=False,
1428-
task_label=None,
1428+
label=None,
14291429
):
14301430
"""Parallel version of builtin `map`, load-balanced by this View.
14311431
@@ -1480,7 +1480,7 @@ def map(
14801480
chunksize=chunksize,
14811481
ordered=ordered,
14821482
return_exceptions=return_exceptions,
1483-
task_label=task_label,
1483+
label=label,
14841484
)
14851485
return pf.map(*sequences)
14861486

ipyparallel/controller/hub.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def empty_record():
7575
'error': None,
7676
'stdout': '',
7777
'stderr': '',
78-
'task_label': None,
78+
'label': None,
7979
}
8080

8181

@@ -112,7 +112,7 @@ def init_record(msg):
112112
'error': None,
113113
'stdout': '',
114114
'stderr': '',
115-
'task_label': msg['metadata'].get('task_label', None),
115+
'label': msg['metadata'].get('label', None),
116116
}
117117

118118

ipyparallel/engine/kernel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def init_metadata(self, parent):
7676
'is_broadcast': parent_metadata.get('is_broadcast', False),
7777
'is_coalescing': parent_metadata.get('is_coalescing', False),
7878
'original_msg_id': parent_metadata.get('original_msg_id', ''),
79-
'task_label': parent_metadata.get('task_label', None),
79+
'label': parent_metadata.get('label', None),
8080
}
8181

8282
def finish_metadata(self, parent, metadata, reply_content):

0 commit comments

Comments
 (0)