+func (cmd *importer) runBatches(stdout io.Writer, inputs []string) error {
+ if cmd.outputFile != "-" {
+ // Not yet implemented, but this should write
+ // the collection to an existing collection,
+ // possibly even an in-place update.
+ return errors.New("cannot specify output file in container mode: not implemented")
+ }
+ runner := arvadosContainerRunner{
+ Name: "lightning import",
+ Client: arvadosClientFromEnv,
+ ProjectUUID: cmd.projectUUID,
+ APIAccess: true,
+ RAM: 350000000000,
+ VCPUs: 96,
+ Priority: cmd.priority,
+ KeepCache: 1,
+ }
+ err := runner.TranslatePaths(&cmd.tagLibraryFile, &cmd.refFile, &cmd.outputFile)
+ if err != nil {
+ return err
+ }
+ for i := range inputs {
+ err = runner.TranslatePaths(&inputs[i])
+ if err != nil {
+ return err
+ }
+ }
+
+ outputs, err := cmd.batchArgs.RunBatches(context.Background(), func(ctx context.Context, batch int) (string, error) {
+ runner := runner
+ if cmd.batches > 1 {
+ runner.Name += fmt.Sprintf(" (batch %d of %d)", batch, cmd.batches)
+ }
+ runner.Args = []string{"import",
+ "-local=true",
+ "-loglevel=" + cmd.loglevel,
+ "-pprof=:6061",
+ fmt.Sprintf("-skip-ooo=%v", cmd.skipOOO),
+ fmt.Sprintf("-output-tiles=%v", cmd.outputTiles),
+ fmt.Sprintf("-save-incomplete-tiles=%v", cmd.saveIncompleteTiles),
+ "-match-chromosome", cmd.matchChromosome.String(),
+ "-output-stats", "/mnt/output/stats.json",
+ "-tag-library", cmd.tagLibraryFile,
+ "-ref", cmd.refFile,
+ "-o", "/mnt/output/library.gob.gz",
+ }
+ runner.Args = append(runner.Args, cmd.batchArgs.Args(batch)...)
+ runner.Args = append(runner.Args, inputs...)
+ return runner.RunContext(ctx)
+ })
+ if err != nil {
+ return err
+ }
+ var outfiles []string
+ for _, o := range outputs {
+ outfiles = append(outfiles, o+"/library.gob.gz")
+ }
+ fmt.Fprintln(stdout, strings.Join(outfiles, " "))
+ return nil
+}
+
+func (cmd *importer) tileFasta(tilelib *tileLibrary, infile string, isRef bool) (tileSeq, []importStats, error) {