def __acquireTask( self, batch, dispatchData ) :

		# If we've already created a task for this batch, then
		# just return it. The Tractor API will take care of turning
		# it into an Instance if we add it as a subtask of more than
		# one parent.

		task = dispatchData["batchesToTasks"].get( batch )
		if task is not None :
			return task

		# Make a task.

		nodeName = batch.node().relativeName( dispatchData["scriptNode"] )
		frames = str( IECore.frameListFromList( [ int( x ) for x in batch.frames() ] ) )
		task = author.Task( title = nodeName + " " + frames )

		# Generate a `gaffer execute` command line suitable for
		# executing the batch.

		args = [
			"gaffer", "execute",
			"-script", dispatchData["scriptFile"],
			"-nodes", nodeName,
			"-frames", frames,
		]

		scriptContext = dispatchData["scriptNode"].context()
		contextArgs = []
		for entry in [ k for k in batch.context().keys() if k != "frame" and not k.startswith( "ui:" ) ] :
			if scriptContext.keys() not in entry or batch.context()[entry] != scriptContext[entry] :
				contextArgs.extend( [ "-" + entry, repr( batch.context()[entry] ) ] )

		if contextArgs :
			args.extend( [ "-context" ] + contextArgs )

		# Create a Tractor command to execute that command line, and add
		# it to the task.

		command = author.Command( argv = args )
		task.addCommand( command )

		# Apply any custom dispatch settings to the command.

		tractorPlug = batch.node()["dispatcher"].getChild( "tractor" )
		if tractorPlug is not None :
			## \todo Remove these manual substitutions once #887 is resolved.
			# Note though that we will need to use `with batch.context()` to
			# ensure the substitutions occur in the right context.
			command.service = batch.context().substitute( tractorPlug["service"].getValue() )
			command.tags = batch.context().substitute( tractorPlug["tags"].getValue() ).split()

		# Remember the task for next time, and return it.

		dispatchData["batchesToTasks"][batch] = task
		return task
dataset/ETHPy150Open ImageEngine/gaffer/python/GafferTractor/TractorDispatcher.py/TractorDispatcher.__acquireTask/swapped operands of `not in`