How to launch multiple Julia runs one after another?

I have 25 *.jl files that need to be run one after another. Each of them could take an extended amount of time.

Is there a way I can create a master_run.jl file and tell Julia to run these 25 jl files one after another. Something like the below?

run A01.jl
run A02.jl
...
run A25.jl

Thanks.

Put in your master_run.jl file the following

run(`julia A01.jl`)
run(`julia A02.jl`)
...
run(`julia A25.jl`)

See Running External Programs · The Julia Language and Getting Started · The Julia Language.

1 Like

Many thanks!

Unfortunately, I got the below error:
ERROR: LoadError: IOError: could not spawn A01.jl: no such file or directory (ENOENT)

The master_run.jl file and the rest of the jl files are in the same directory.

This is what I do:

mzaffalon@NBFAE01-6CS3PF2 MINGW64 ~/test
$ ls
A01.jl  A02.jl  master_run.jl 

mzaffalon@NBFAE01-6CS3PF2 MINGW64 ~/test
$ cat master_run.jl
run(`julia A01.jl`)
run(`julia A02.jl`)

mzaffalon@NBFAE01-6CS3PF2 MINGW64 ~/test
$ julia
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.8.0-rc1 (2022-05-27)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> include("master_run.jl")
A01: hello world
A02: hello world
Process(`julia A02.jl`, ProcessExited(0))

julia>
1 Like

Many thanks! It is working now.

I turns out I missed the ‘julia’ part inside the parentheses.