func Status(w http.ResponseWriter, r *http.Request) {
	fmt.Fprintf(w, "<html><body>\n")
	fmt.Fprintf(w, "<p>NOTE: This is just one of potentially many instances.</p>\n")
	commit := etl.GitCommit
	if len(commit) >= 8 {
		fmt.Fprintf(w, "Release: %s <br>  Commit: <a href=\"https://github.com/m-lab/etl/tree/%s\">%s</a><br>\n",
			etl.Version, etl.GitCommit, etl.GitCommit[0:7])
	} else {
		fmt.Fprintf(w, "Release: %s   Commit: %s\n", etl.Version, etl.GitCommit)
	}
	if gardenerAPI != nil {
		gardenerAPI.Status(w)
	}
	switch outputType.Value {
	case "bigquery":
		fmt.Fprintf(w, "Writing output to BigQuery\n")
	case "gcs":
		fmt.Fprintf(w, "Writing output to %s\n", outputBucket())
	}
	fmt.Fprintf(w, "<p>Workers: %d / %d</p>\n", atomic.LoadInt32(&inFlight), maxInFlight)
	env := os.Environ()
	for i := range env {
		fmt.Fprintf(w, "%s</br>\n", env[i])
	}
	fmt.Fprintf(w, "</body></html>\n")
}
Task Queue can always submit to an admin restricted URL.
login: admin
Return 200 status code.
Track reqeusts that last longer than 24 hrs.
Is task handling idempotent?
Useful headers added by AppEngine when sending Tasks via Push.
X-AppEngine-QueueName
X-AppEngine-TaskETA
X-AppEngine-TaskName
X-AppEngine-TaskRetryCount
X-AppEngine-TaskExecutionCount
Status writes a status summary to a ResponseWriter, and can be used as a Handler.
TODO(gfr) Add either a black list or a white list for the environment
variables, so we can hide sensitive vars. https://github.com/m-lab/etl/issues/384
package main
import (
	"context"
	"flag"
	"fmt"
	"log"
	"net/http"
	"net/url"
	"os"
	"runtime"
	"strconv"
	"sync/atomic"
	"time"
	gcs "cloud.google.com/go/storage"
	"golang.org/x/sync/errgroup"
	"github.com/m-lab/go/flagx"
	"github.com/m-lab/go/httpx"
	"github.com/m-lab/go/prometheusx"
	"github.com/m-lab/go/rtx"
	"github.com/m-lab/etl/active"
	"github.com/m-lab/etl/bq"
	"github.com/m-lab/etl/etl"
	"github.com/m-lab/etl/factory"
	"github.com/m-lab/etl/metrics"
	"github.com/m-lab/etl/storage"
	"github.com/m-lab/etl/task"
	"github.com/m-lab/etl/worker"
	"github.com/m-lab/annotation-service/site"
	_ "net/http/pprof"
	_ "expvar"
)
const defaultMaxInFlight = 20
var (
	maxInFlight int32  
	inFlight    int32  
)
var (
	outputType = flagx.Enum{
		Options: []string{"gcs", "bigquery", "local"},
		Value:   "bigquery",
	}
	maxActiveTasks = flag.Int64("max_active", 1, "Maximum number of active tasks")
	gardenerHost   = flag.String("gardener_host", "", "Gardener host for jobs")
	servicePort     = flag.String("service_port", ":8080", "The main (private) service port")
	shutdownTimeout = flag.Duration("shutdown_timeout", 1*time.Minute, "Graceful shutdown time allowance")
	gcloudProject   = flag.String("gcloud_project", "", "GCP Project id")
	maxWorkers      = flag.Int("max_workers", defaultMaxInFlight, "Maximum number of workers")
	isBatch         = flag.Bool("batch_service", false, "Whether to run the parser in batch mode")
	omitDeltas      = flag.Bool("ndt_omit_deltas", false, "Whether to skip ndt.web100 snapshot deltas")
	bigqueryProject = flag.String("bigquery_project", "", "Override GCLOUD_PROJECT for BigQuery operations")
	bigqueryDataset = flag.String("bigquery_dataset", "", "Override the BigQuery dataset for output tables")
	outputDir       = flag.String("output_dir", "", "If output type is 'local', write output to this directory")
	annotatorURL    = flagx.MustNewURL("https://annotator-dot-mlab-sandbox.appspot.com")
)
var (
	mainCtx, mainCancel = context.WithCancel(context.Background())
	gardenerAPI *active.GardenerAPI
)
func init() {
	log.SetFlags(log.LstdFlags | log.Lshortfile)
	flag.Var(&outputType, "output", "Output to bigquery or gcs.")
	flag.Var(&annotatorURL, "annotator_url", "Base URL for the annotation service.")
}