code: def __create_and_save_state(cls, job_config, mapreduce_spec):
      
      state = model.MapreduceState.create_new(job_config.job_id)
      state.mapreduce_spec = mapreduce_spec
      state.active = True
      state.active_shards = 0
      state.app_id = job_config._app
      config = datastore_rpc.Configuration(force_writes=job_config._force_writes)
      state.put(config=config)
      return state
docs: Save map job state to datastore.
  
      Save state to datastore so that UI can see it immediately.
  
      Args:
        job_config: map_job.JobConfig.
        mapreduce_spec: model.MapreduceSpec.
  
      Returns:
        model.MapreduceState for this job.