code: func (DatastoreTaskNumAllocator) NotifyTaskIsAlive(c context.Context, task *target.Task, instanceID string) (taskNum int, err error) {
  	c = dsContext(c)
  
  	// Exact values here are not important. Important properties are:
  	//  * 'entityID' is unique, and depends on both 'task' and 'instanceID'.
  	//  * All instances from same task have same 'target' value.
  	//
  	// The cron ('AssignTaskNumbers') will fetch all entities and will group them
  	// by 'target' value before assigning task numbers.
  	target := fmt.Sprintf("%s|%s|%s|%s", task.DataCenter, task.ServiceName, task.JobName, task.HostName)
  	entityID := fmt.Sprintf("%s|%s", target, instanceID)
  
  	err = datastore.RunInTransaction(c, func(c context.Context) error {
  		entity := instance{ID: entityID}
  		switch err := datastore.Get(c, &entity); {
  		case err == datastore.ErrNoSuchEntity:
  			entity.Target = target
  			entity.TaskNum = -1
  		case err != nil:
  			return err
  		}
  		entity.LastUpdated = clock.Now(c).UTC()
  		taskNum = entity.TaskNum
  		return datastore.Put(c, &entity)
  	}, nil)
  	if err == nil && taskNum == -1 {
  		err = tsmon.ErrNoTaskNumber
  	}
  	return
  }
docs: // NotifyTaskIsAlive is part of TaskNumAllocator interface.