Skip to content

Commit

Permalink
Run bulk loader existence check on individual files (#3681)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas Wang committed Jul 17, 2019
1 parent 7f7b3e6 commit f1c5f44
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions dgraph/cmd/bulk/run.go
Expand Up @@ -134,10 +134,16 @@ func run() {
if opt.DataFiles == "" {
fmt.Fprint(os.Stderr, "RDF or JSON file(s) location must be specified.\n")
os.Exit(1)
} else if _, err := os.Stat(opt.DataFiles); err != nil && os.IsNotExist(err) {
fmt.Fprintf(os.Stderr, "Data path(%v) does not exist.\n", opt.DataFiles)
os.Exit(1)
} else {
fileList := strings.Split(opt.DataFiles, ",")
for _, file := range fileList {
if _, err := os.Stat(file); err != nil && os.IsNotExist(err) {
fmt.Fprintf(os.Stderr, "Data path(%v) does not exist.\n", file)
os.Exit(1)
}
}
}

if opt.ReduceShards > opt.MapShards {
fmt.Fprintf(os.Stderr, "Invalid flags: reduce_shards(%d) should be <= map_shards(%d)\n",
opt.ReduceShards, opt.MapShards)
Expand Down

0 comments on commit f1c5f44

Please sign in to comment.