@@ -156,6 +156,8 @@ def set_flags(self, **kwargs):
156156 else :
157157 setattr (self , name , value )
158158
159+ return self # returning self would allow direct calling of map/apply in one command (no context manager)
160+
159161 @contextmanager
160162 def temp_flags (self , ** kwargs ):
161163 """temporarily set flags, for use in `with` statements.
@@ -570,12 +572,7 @@ def _really_apply(
570572 block = self .block if block is None else block
571573 track = self .track if track is None else track
572574 targets = self .targets if targets is None else targets
573- label = (
574- self .label if label is None else label
575- ) # comes into play when calling map[_async] (self.label)
576- label = (
577- kwargs .pop ("label" ) if "label" in kwargs and label is None else label
578- ) # this is required can calling apply[_async]
575+ label = self .label if label is None else label
579576 metadata = dict (label = label )
580577
581578 _idents , _targets = self .client ._build_targets (targets )
@@ -659,6 +656,8 @@ def map(
659656
660657 if block is None :
661658 block = self .block
659+ if label is None :
660+ label = self .label
662661
663662 assert len (sequences ) > 0 , "must have some sequences to map onto!"
664663 pf = ParallelFunction (
@@ -1318,6 +1317,8 @@ def set_flags(self, **kwargs):
13181317
13191318 self .timeout = t
13201319
1320+ return self # returning self would allow direct calling of map/apply in one command (no context manager)
1321+
13211322 @sync_results
13221323 @save_ids
13231324 def _really_apply (
@@ -1388,12 +1389,7 @@ def _really_apply(
13881389 follow = self .follow if follow is None else follow
13891390 timeout = self .timeout if timeout is None else timeout
13901391 targets = self .targets if targets is None else targets
1391- label = (
1392- self .label if label is None else label
1393- ) # comes into play when calling map[_async] (self.label)
1394- label = (
1395- kwargs .pop ("label" ) if "label" in kwargs and label is None else label
1396- ) # this is required can calling apply[_async]
1392+ label = self .label if label is None else label
13971393
13981394 if not isinstance (retries , int ):
13991395 raise TypeError (f'retries must be int, not { type (retries )!r} ' )
@@ -1489,6 +1485,8 @@ def map(
14891485 # default
14901486 if block is None :
14911487 block = self .block
1488+ if label is None :
1489+ label = self .label
14921490
14931491 assert len (sequences ) > 0 , "must have some sequences to map onto!"
14941492
0 commit comments