Relentless
Relentless

Reputation: 81

GNU Parallel timeout for process

I want to use GNU Parallel for this command:

seq -w 30 | parallel -k -j6 java -javaagent:build/libs/pddl4j-3.1.0.jar -server -Xms8048m -Xmx8048m fr.uga.pddl4j.planners.hsp.HSP -o pddl/benchmarks_STRIPS/benchmarks_STRIPS/ipc1/movie/domain.pddl -f pddl/benchmarks_STRIPS/benchmarks_STRIPS/ipc1/movie/p{}.pddl -i 8 '>>' AstarMovie.txt

I have a timeout of 600 seconds in the java program but parallel doesn't execute it. Processes can run for 2, 3, 4 or more hours and never stop.

I tried this command based on the GNU tutorial online, but it doesn't work either:

seq -w 30 | parallel -k --timeout 600000 -j6 java -javaagent:build/libs/pddl4j-3.1.0.jar -server -Xms2048m -Xmx2048m fr.uga.pddl4j.planners.hsp.HSP -o pddl/benchmarks_STRIPS/benchmarks_STRIPS/ipc1/movie/domain.pddl -f pddl/benchmarks_STRIPS/benchmarks_STRIPS/ipc1/movie/p{}.pddl -i 8 '>>' AstarMovie.txt

I saw in the tutorial that GNU Parallel uses milliseconds - so 600000 is 10 minutes which is what I need but after 12 minutes the process was still running. I need 6 processes to run at once for a maximum of 10 minutes each.

Any help would be great. Thanks.

EDIT: Why do people feel the need to edit posts for small changes like '600seconds' to '600 seconds'? Stop doing it for karma..

Upvotes: 2

Views: 3458

Answers (1)

Mark Setchell
Mark Setchell

Reputation: 207455

The timeout for GNU Parallel is given in seconds, not milliseconds. You can test it with this snippet which waits for 15 seconds but with a timeout that cuts it off after 10 seconds:

time parallel --timeout 10 sleep {} ::: 15

real    0m10.961s
user    0m0.071s
sys     0m0.038s

Upvotes: 8

Related Questions