go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/resultdb/cmd/recorder/main.go (about)

     1  // Copyright 2019 The LUCI Authors.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //      http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  package main
    16  
    17  import (
    18  	"flag"
    19  	"time"
    20  
    21  	"go.chromium.org/luci/config/server/cfgmodule"
    22  	"go.chromium.org/luci/server"
    23  	"go.chromium.org/luci/server/module"
    24  	quota "go.chromium.org/luci/server/quotabeta"
    25  
    26  	"go.chromium.org/luci/resultdb/internal"
    27  	"go.chromium.org/luci/resultdb/internal/artifactcontent"
    28  	"go.chromium.org/luci/resultdb/internal/rpcquota"
    29  	"go.chromium.org/luci/resultdb/internal/services/recorder"
    30  )
    31  
    32  func main() {
    33  	opts := recorder.Options{}
    34  	expectedTestResultsExpirationDays := flag.Int(
    35  		"expected-results-expiration",
    36  		60,
    37  		"How many days to keep results for test variants with only expected results",
    38  	)
    39  	flag.Int64Var(
    40  		&opts.MaxArtifactContentStreamLength,
    41  		"max-artifact-content-stream-length",
    42  		64*1024*1024, // 64 MiB
    43  		"Maximum length of an artifact content stream to accept",
    44  	)
    45  
    46  	artifactcontent.RegisterRBEInstanceFlag(flag.CommandLine, &opts.ArtifactRBEInstance)
    47  
    48  	modules := []module.Module{
    49  		// rpcquota and cfgmodule must be installed before quota, so
    50  		// they need to be passed here rather than declared as
    51  		// Dependencies of quota.
    52  		rpcquota.NewModuleFromFlags(),
    53  		cfgmodule.NewModuleFromFlags(),
    54  		quota.NewModuleFromFlags(),
    55  	}
    56  	internal.MainWithModules(modules, func(srv *server.Server) error {
    57  		opts.ExpectedResultsExpiration = time.Duration(*expectedTestResultsExpirationDays) * 24 * time.Hour
    58  		return recorder.InitServer(srv, opts)
    59  	})
    60  }