()
| 37 | const BulkBadgerDefaults = "compression=snappy; numgoroutines=8;" |
| 38 | |
| 39 | func init() { |
| 40 | Bulk.Cmd = &cobra.Command{ |
| 41 | Use: "bulk", |
| 42 | Short: "Run Dgraph Bulk Loader", |
| 43 | Run: func(cmd *cobra.Command, args []string) { |
| 44 | defer x.StartProfile(Bulk.Conf).Stop() |
| 45 | run() |
| 46 | }, |
| 47 | Annotations: map[string]string{"group": "data-load"}, |
| 48 | } |
| 49 | Bulk.Cmd.SetHelpTemplate(x.NonRootTemplate) |
| 50 | Bulk.EnvPrefix = "DGRAPH_BULK" |
| 51 | |
| 52 | flag := Bulk.Cmd.Flags() |
| 53 | flag.StringP("files", "f", "", |
| 54 | "Location of *.rdf(.gz) or *.json(.gz) file(s) to load.") |
| 55 | flag.StringP("schema", "s", "", |
| 56 | "Location of schema file.") |
| 57 | flag.StringP("graphql_schema", "g", "", "Location of the GraphQL schema file.") |
| 58 | flag.String("format", "", |
| 59 | "Specify file format (rdf or json) instead of getting it from filename.") |
| 60 | flag.Bool("encrypted", false, |
| 61 | "Flag to indicate whether schema and data files are encrypted. "+ |
| 62 | "Must be specified with --encryption or vault option(s).") |
| 63 | flag.Bool("encrypted_out", false, |
| 64 | "Flag to indicate whether to encrypt the output. "+ |
| 65 | "Must be specified with --encryption or vault option(s).") |
| 66 | flag.String("out", defaultOutDir, |
| 67 | "Location to write the final dgraph data directories.") |
| 68 | flag.Bool("replace_out", false, |
| 69 | "Replace out directory and its contents if it exists.") |
| 70 | flag.String("tmp", "tmp", |
| 71 | "Temp directory used to use for on-disk scratch space. Requires free space proportional"+ |
| 72 | " to the size of the RDF file and the amount of indexing used.") |
| 73 | |
| 74 | flag.IntP("num_go_routines", "j", int(math.Ceil(float64(runtime.NumCPU())/4.0)), |
| 75 | "Number of worker threads to use. MORE THREADS LEAD TO HIGHER RAM USAGE.") |
| 76 | flag.Int64("mapoutput_mb", 2048, |
| 77 | "The estimated size of each map file output. Increasing this increases memory usage.") |
| 78 | flag.Int64("partition_mb", 4, "Pick a partition key every N megabytes of data.") |
| 79 | flag.Bool("skip_map_phase", false, |
| 80 | "Skip the map phase (assumes that map output files already exist).") |
| 81 | flag.Bool("skip_reduce_phase", false, |
| 82 | "Skip the reduce phase (stops after map phase completion).") |
| 83 | flag.Bool("cleanup_tmp", true, |
| 84 | "Clean up the tmp directory after the loader finishes. Setting this to false allows the"+ |
| 85 | " bulk loader can be re-run while skipping the map phase.") |
| 86 | flag.Int("reducers", 1, |
| 87 | "Number of reducers to run concurrently. Increasing this can improve performance, and "+ |
| 88 | "must be less than or equal to the number of reduce shards.") |
| 89 | flag.Bool("version", false, "Prints the version of Dgraph Bulk Loader.") |
| 90 | flag.Bool("store_xids", false, "Generate an xid edge for each node.") |
| 91 | flag.StringP("zero", "z", "localhost:5080", "gRPC address for Dgraph zero") |
| 92 | flag.String("xidmap", "", "Directory to store xid to uid mapping") |
| 93 | // TODO: Potentially move http server to main. |
| 94 | flag.String("http", "localhost:8080", "Address to serve http (pprof).") |
| 95 | flag.Bool("ignore_errors", false, "ignore line parsing errors in rdf files") |
| 96 | flag.Bool("log_errors", false, "log parsing errors to a file (requires --ignore_errors)") |
nothing calls this directly
no test coverage detected