def StartMap(operation_key, job_name, handler_spec, reader_spec, writer_spec, mapper_params, mapreduce_params=None, start_transaction=True, queue_name=None, shard_count=MAPREDUCE_DEFAULT_SHARDS):
 if (not mapreduce_params):
  mapreduce_params = {}
 mapreduce_params[DatastoreAdminOperation.PARAM_DATASTORE_ADMIN_OPERATION] = str(operation_key)
 mapreduce_params['done_callback'] = ('%s/%s' % (config.BASE_PATH, MapreduceDoneHandler.SUFFIX))
 if (queue_name is not None):
  mapreduce_params['done_callback_queue'] = queue_name
 mapreduce_params['force_writes'] = 'True'
 def tx():
  operation = DatastoreAdminOperation.get(operation_key)
  job_id = control.start_map(job_name, handler_spec, reader_spec, mapper_params, output_writer_spec=writer_spec, mapreduce_parameters=mapreduce_params, base_path=config.MAPREDUCE_PATH, shard_count=shard_count, transactional=True, queue_name=queue_name, transactional_parent=operation)
  operation.status = DatastoreAdminOperation.STATUS_ACTIVE
  operation.active_jobs += 1
  operation.active_job_ids = list(set((operation.active_job_ids + [job_id])))
  operation.put(config=_CreateDatastoreConfig())
  return job_id
 if start_transaction:
  return db.run_in_transaction(tx)
 else:
  return tx()

def StartMap ( operation_key , job_name , handler_spec , reader_spec , writer_spec , mapper_params , mapreduce_params = None , start_transaction = True , queue_name = None , shard_count = MAPREDUCE_DEFAULT_SHARDS ) : if ( not mapreduce_params ) : mapreduce_params = { } mapreduce_params [ DatastoreAdminOperation . PARAM_DATASTORE_ADMIN_OPERATION ] = str ( operation_key ) mapreduce_params [ 'done_callback' ] = ( '%s/%s' % ( config . BASE_PATH , MapreduceDoneHandler . SUFFIX ) ) if ( queue_name is not None ) : mapreduce_params [ 'done_callback_queue' ] = queue_name mapreduce_params [ 'force_writes' ] = 'True' def tx ( ) : operation = DatastoreAdminOperation . get ( operation_key ) job_id = control . start_map ( job_name , handler_spec , reader_spec , mapper_params , output_writer_spec = writer_spec , mapreduce_parameters = mapreduce_params , base_path = config . MAPREDUCE_PATH , shard_count = shard_count , transactional = True , queue_name = queue_name , transactional_parent = operation ) operation . status = DatastoreAdminOperation . STATUS_ACTIVE operation . active_jobs += 1 operation . active_job_ids = list ( set ( ( operation . active_job_ids + [ job_id ] ) ) ) operation . put ( config = _CreateDatastoreConfig ( ) ) return job_id if start_transaction : return db . run_in_transaction ( tx ) else : return tx ( )
start map as part of datastore admin operation .