in src/go/cmd/cachewarmer/cachewarmer-jobsubmitter/main.go [33:123]
func initializeApplicationVariables(ctx context.Context) (*cachewarmer.WarmPathJob, *cachewarmer.CacheWarmerQueues, bool) {
var enableDebugging = flag.Bool("enableDebugging", false, "enable debug logging")
var warmTargetMountAddresses = flag.String("warmTargetMountAddresses", "", "the warm target cache filer mount addresses separated by commas")
var warmTargetExportPath = flag.String("warmTargetExportPath", "", "the warm target export path")
var warmTargetPath = flag.String("warmTargetPath", "", "the warm target path")
var inclusionCsv = flag.String("inclusionCsv", "", "the inclusion list of file match strings per https://golang.org/pkg/path/filepath/#Match. Leave blank to include everything.")
var exclusionCsv = flag.String("exclusionCsv", "", "the exclusion list of file match strings per https://golang.org/pkg/path/filepath/#Match. Leave blank to not exlude anything.")
var maxFileSizeBytes = flag.Int64("maxFileSizeBytes", 0, "the maximum file size in bytes to warm.")
var storageAccountResourceGroup = flag.String("storageAccountResourceGroup", "", "the storage account resource group")
var storageAccount = flag.String("storageAccountName", "", "the storage account name to host the queue")
var queueNamePrefix = flag.String("queueNamePrefix", "", "the queue name to be used for organizing the work. The queues will be created automatically")
var blockUntilWarm = flag.Bool("blockUntilWarm", false, "the job submitter will not return until there are no more jobs")
flag.Parse()
if *enableDebugging {
log.EnableDebugging()
}
if len(*warmTargetMountAddresses) == 0 {
fmt.Fprintf(os.Stderr, "ERROR: warmTargetMountAddresses not specified\n")
usage()
os.Exit(1)
}
if len(*warmTargetExportPath) == 0 {
fmt.Fprintf(os.Stderr, "ERROR: warmTargetExportPath not specified\n")
usage()
os.Exit(1)
}
if len(*warmTargetPath) == 0 {
fmt.Fprintf(os.Stderr, "ERROR: warmTargetPath is not specified\n")
usage()
os.Exit(1)
}
if len(*storageAccountResourceGroup) == 0 {
fmt.Fprintf(os.Stderr, "ERROR: storageAccountResourceGroup is not specified\n")
usage()
os.Exit(1)
}
if len(*storageAccount) == 0 {
fmt.Fprintf(os.Stderr, "ERROR: storageAccount is not specified\n")
usage()
os.Exit(1)
}
if len(*queueNamePrefix) == 0 {
fmt.Fprintf(os.Stderr, "ERROR: queueNamePrefix is not specified\n")
usage()
os.Exit(1)
}
if isValid, errorMessage := azure.ValidateQueueName(*queueNamePrefix); isValid == false {
fmt.Fprintf(os.Stderr, "ERROR: queueNamePrefix is not valid: %s\n", errorMessage)
usage()
os.Exit(1)
}
primaryKey, err := cachewarmer.GetPrimaryStorageKey(ctx, *storageAccountResourceGroup, *storageAccount)
if err != nil {
fmt.Fprintf(os.Stderr, "ERROR: unable to get storage account key: %s", err)
os.Exit(1)
}
warmJobPath := cachewarmer.InitializeWarmPathJob(
*warmTargetMountAddresses,
*warmTargetExportPath,
*warmTargetPath,
*inclusionCsv,
*exclusionCsv,
*maxFileSizeBytes)
cacheWarmerQueues, err := cachewarmer.InitializeCacheWarmerQueues(
ctx,
*storageAccount,
primaryKey,
*queueNamePrefix)
if err != nil {
fmt.Fprintf(os.Stderr, "ERROR: error initializing queue %v\n", err)
os.Exit(1)
}
return warmJobPath, cacheWarmerQueues, *blockUntilWarm
}